Hello,
I apologize for the issue you are facing. To assign your JetEngine repeater field "Steps" to the How-To schema in Rank Math, you will need to ensure that the data from your repeater field is correctly formatted and integrated into the schema markup.
Here’s a general approach you can follow:
-
Ensure Rank Math is Installed: Make sure you have the Rank Math plugin installed and activated on your WordPress site.
-
Use Custom Fields: In your custom post type settings, ensure that the repeater field for "Steps" is set up correctly. You may need to use a code snippet to pull the data from the repeater field into the schema.
-
Add Code Snippet: You can add a custom code snippet to your theme’s functions.php
file or a custom plugin to integrate the repeater field with the How-To schema. Here’s an example of how you might structure it:
add_filter( 'rank_math/json_ld', function( $data, $jsonld ) {
if ( is_singular('guides') ) { // Check if it's a single guide post
$data['howTo'] = [
'@type' => 'HowTo',
'name' => get_the_title(),
'step' => []
];
if ( have_rows('steps') ) { // Replace 'steps' with your repeater field name
while ( have_rows('steps') ) {
the_row();
$data['howTo']['step'][] = [
'@type' => 'HowToStep',
'name' => get_sub_field('step_name'), // Replace with your sub-field name
'url' => get_permalink(),
'itemListElement' => get_sub_field('step_description') // Replace with your sub-field name
];
}
}
}
return $data;
}, 10, 2 );
Make sure to replace 'steps'
, 'step_name'
, and 'step_description'
with the actual names of your fields.
-
Test Your Schema: After implementing the code, use Google’s Rich Results Testing Tool to verify that your How-To schema is being generated correctly.
If you need more detailed assistance or if this doesn’t resolve your issue, we recommend replying to your ticket, and a human agent from the Rank Math Support team will assist you further. Thank you for raising this concern!
Sources:
Configuring “Schema Markup” in Rank Math » Rank Math
I really don’t want to add code-snippets as a permeant solution as the client says he’s buying a pro-subscription too. Will this issue be resolved in the next update?
Hello,
If you’re using JetEngine, the %customfield()%
variable may not work as expected, so you’ll have to create a custom variable to use it in the schema.
Here’s a guide you can follow:
https://rankmath.com/kb/variables-in-seo-title-description/#how-to-add-custom-variables
Looking forward to helping you.
What if I use Advance Custom Fields? Could you guide me through that too as I am frustrated with JetEngine & Crocoblock support so I’m hoping to switch to ACF
Hello,
Sorry, but this will still require some coding from your end. Here’s an example of how we pick up repeater fields from ACF for a FAQ page: https://rankmath.com/kb/automate-faq-schema-with-acf-repeater-fields/
The same goes for How-to schemas, there are just some parts of the code that require changing.
Don’t hesitate to get in touch with us if you have any other questions.