[RECIPE SCHEMA FIELDS] Auto complete

#73813
Viewing 8 replies - 1 through 8 (of 8 total)
  • Hello,

    Thank you for contacting Rank Math today.

    You can use following filter to change the Recipe schema output: https://rankmath.com/kb/filters-hooks-api-developer/#change-post-schema-data

    Here is an example:

    
    add_filter( "rank_math/snippet/rich_snippet_recipe_entity", function( $entity ) {
     $entity['name'] = get_post_meta( POST_ID, '_custom_field_key', true );
     $entity['description'] = get_post_meta( POST_ID, '_custom_field_key', true );
     $entity['prepTime'] = get_post_meta( POST_ID, '_custom_field_key', true );
     return $entity;
    }, 99 );
    

    I hope that helps. Thank you.
    ​​​​​​

    Hello Pratik, first of all, thank you for your answer.

    I tried to use it but I could not get the job done.

    So I tried to debug, to see where this filter should be triggered, by putting a

    echo 'pre>'. print_r($entity) . '/pre>';

    command line inside the filter hook suggested by you that was not working.

    It was not triggered anywhere I looked up.

    So I thought that maybe was the place that I put the code (my own plugin), so I tried other hook there to try it out, and the other random hook placed there worked. So it was not the place.

    ——-

    Do you have any clue about why it is not working like the other hooks?

    Something strange…

    I did:

    	add_filter( 'rank_math/metabox/tabs', function( $tabs) {
    		echo 'pre>'. print_r($tabs) . '/pre>';
    		return $tabs;
    	});

    What I got was:

    Array ( 
    	[general] => Array ( 
    		[icon] => rm-icon rm-icon-settings 
    		[title] => General 
    		[desc] => This tab contains general options. 
    		[file] => .../wp-content/plugins/seo-by-rank-math/includes/metaboxes/general.php 
    		[capability] => onpage_general ) 
    	[advanced] => Array ( 
    		[icon] => rm-icon rm-icon-toolbox 
    		[title] => Advanced [desc] => This tab contains advance options. 
    		[file] => .../wp-content/plugins/seo-by-rank-math/includes/metaboxes/advanced.php 
    		[capability] => onpage_advanced ) 
    	[social] => Array ( 
    		[icon] => rm-icon rm-icon-social 
    		[title] => Social 
    		[desc] => This tab contains social options. 
    		[file] => .../wp-content/plugins/seo-by-rank-math/includes/metaboxes/social.php 
    		[capability] => onpage_social 
    	) 
    )

    So it did not appear the “schema” value with the other tabs(“general”, “advanced”, “social”)

    Hello,

    rank_math/metabox/tabs This filter is for tabs. If you want to change or remove any tab in the admin page then you can use this.

    You want to change the Recipe schema values on frontend where schema data is added, right? The filter I gave you should have worked. Can you please give us the complete code?

    Looking forward to helping you.

    I got it now! It works just in the front-end. In the back-end it remains the same.

    Now I see it.

    It is working perfectly!

    Thank you!

    Hello,

    We are glad to hear that it is working.

    Do you wish to mark this thread as resolved?

    If you have any further question(s), please let us know. Thank you.

    Marked! Thank you all of you!

    Alberto
    Rank Math business

    Hello Luis,

    We are super happy that this resolved your issue. If you have any other questions in the future, know that we are here to help you.

    If you don’t mind me asking, could you please leave us a review (if you haven’t already) on https://wordpress.org/support/plugin/seo-by-rank-math/reviews/#new-post about your overall experience with Rank Math? We appreciate your time and patience.

    If you do have another question in the future, please feel free to create a new forum topic, and it will be our pleasure to assist you again.

    Thank you.

Viewing 8 replies - 1 through 8 (of 8 total)

You must be logged in to reply to this ticket.