• Resolved rocketpig3

    (@rocketpig3)


    Hi,

    I am trying to remove all author metadata from my blog posts. I have tried this code from https://rankmath.com/blog/remove-the-author-name-wordpress/:

    add_filter(“rank_math / snippet / rich_snippet_article_entity”, function ( $entity ) {
    if ( isset( $entity[‘author’] ) ) {
    unset( $entity[‘author’] );
    return $entity;
    }
    return $entity;
    });

    But it is throwing this error:

    Your PHP code changes were rolled back due to an error on line 151 of file wp-content/themes/generatepress-child/functions.php. Please fix and try saving again.

    Uncaught Error: Undefined constant ““rank_math” in wp-content/themes/generatepress-child/functions.php:151

    I would also like to change the schema type for all blog posts from Article to webPage. However there is no option to set this here: /wp-admin/admin.php?page=rank-math-options-titles

    Thanks

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Support Rank Math Support

    (@rankmathteam)

    Hello @rocketpig3,

    Thank you for contacting support.

    The filter you are adding contains some space where it shouldn’t and those cause the issues.

    Please use this one instead:
    add_filter("rank_math/snippet/rich_snippet_article_entity", function ( $entity ) { if ( isset( $entity['author'] ) ) { unset( $entity['author'] ); return $entity; } return $entity; });

    Hope this helps solve your issues.

    Don’t hesitate to get in touch if you have any other questions.

    Thread Starter rocketpig3

    (@rocketpig3)

    Hi,

    Thanks. Just following up on the second part of my question.

    Thanks

    Plugin Support Rank Math Support

    (@rankmathteam)

    Hello @rocketpig3,

    That type of Schema is added automatically to every page on the website by our plugin.

    To edit the data from that Schema, you would need to use the following filter:
    https://rankmath.com/kb/filters-hooks-api-developer/#extend-json-ld-data

    Don’t hesitate to get in touch if you have any other questions.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘How to remove author from schema and change article > webpage’ is closed to new replies.