Filter to change Front-end Schema data

#53896
  • Resolved Euse
    Rank Math free

    Hi,
    How can I change this filter to shema type “Article” and article type “News Article”. I would appreciate if you can give me the working code. Thank you.

    **
    * Filter to change the schema data.
    * Replace $schmea_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;
    });

Viewing 1 replies (of 1 total)
  • Hello,

    Thank you for contacting Rank Math today.

    The following is a sample application. Please test and let us know how it goes.

    **
     * 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_article_entity", function( $entity ) {
     $entity['article'] = [
             '@type'    => 'News article',
         ];
     return $entity;
    });

    Looking forward to helping you. Thank you.

    ​​​​​​

    Hello,

    Since we did not hear back from you for 15 days, we are assuming that you found the solution. We are closing this support ticket.

    If you still need assistance or any other help, please feel free to open a new support ticket, and we will be more than happy to assist.

    Thank you.

Viewing 1 replies (of 1 total)

The ticket ‘Filter to change Front-end Schema data’ is closed to new replies.