Add schema parameters

#399319
  • Resolved Corey Northcutt
    Rank Math free

    Hi,

    I’d like to add the “editor” parameter to Articles and I don’t see a way to do so. Is it possible that there’s a supporting plugin or functions.php filter that could be leveraged to make that go?

    I understand that the web-based schema editor is now a paid feature for Rank Math and appreciate that but it sort of seems like overkill for this particular site.

    Thanks!

Viewing 5 replies - 1 through 5 (of 5 total)
  • Anas
    Rank Math business

    Hello,

    Thank you for contacting Rank Math.

    You can modify and use this filter:

    /**
     * Filter to change the schema data.
     * Replace $schema_type with schema name like article, review, etc.
     * @param array $entity Snippet Data
     * @return array
     */
    add_filter( "rank_math/snippet/rich_snippet_{$schema}_entity", function( $entity ) {
     return $entity;
    });

    Hope that helps.

    Thank you.

    OK thanks, I think that’s clear…

    So, after swapping out {$schema} with a particular schema name, $entity is an array containing all parameters, and that can just be adjusted before returning?

    Nigel
    Rank Math business

    Hello,

    Yes, you understood correctly. Please check this screencast of the the filter applied to article schema with a an extra line of code for debugging so you can view the contents of $entity: https://i.rankmath.com/H5fnMu

    The code snippet used in the screencast:

    
    add_filter( "rank_math/snippet/rich_snippet_article_entity", function( $entity ) {
    	echo "<pre>", var_dump($entity), "</pre>"; // this line is for debugging. Remove if using on a live website
    	return $entity;
       });
    

    Hope that helps. Please let us know if you have questions.

    Beautiful, thanks guys!

    Prabhat
    Rank Math agency

    Hello,

    We are super happy that we could address your concern. If you have any other questions in the future, know that we are here to help you.

    If you don’t mind us 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 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 5 replies - 1 through 5 (of 5 total)

The ticket ‘Add schema parameters’ is closed to new replies.