Change author value in json-ld

#53029
  • Resolved Foo
    Rank Math free

    Hi, How can I change the “author” value in json-ld with the hook:
    add_filter( ‘rank_math/json_ld’, function( $data, $jsonld ) { }
    Thanks

Viewing 8 replies - 1 through 8 (of 8 total)
  • Foo
    Rank Math free

    Hi, I want change the “author” in json-ld. I found the

    add_filter( ‘rank_math/json_ld’, function( $data, $jsonld )

    But how to use this? Or is there have another way to do this?

    Thanks

    Hello,

    Thank you for contacting Rank Math today.

    Could you please let us know the schema type that you want to modify this value for?

    Looking forward to helping you. Thank you.

    ​​​​​​

    Foo
    Rank Math free

    Hi,
    This is blog post and the Schema Type is Article.
    Thanks

    Hello,

    Please use following filter to change the author value in Article Schema:

    
    add_filter( 'rank_math/snippet/rich_snippet_article_entity', function( $entity ) {
        $entity['author'] = [
    	'@type' => 'Person',
    	'name'  => 'Author Name',
        ];
    
        return $entity;
    });
    
    

    I hope that helps.

    Foo
    Rank Math free

    Hi,
    Thank for help Pratik
    How about change “author name” for Review of a Book?

    {
       "@context":"https:\/\/schema.org",
       "@graph":[
          {
             "@type":"Book",
             "name":"My New Book | Domain",
             "author":[
                {
                   "@type":"Person",
                   "name":"Someone"
                }
             ],
             "url":"https:\/\/www.domain.com\/my-new-book\/",
             "hasPart":[
                {
                   "@type":"Book",
                   "bookEdition":"",
                   "bookFormat":"https:\/\/schema.org\/Hardcover",
                   "datePublished":"",
                   "isbn":"978-604-9959-81-3",
                   "name":"My new book",
                   "author":[
                      {
                         "@type":"Person",
                         "name":"Someone"
                      }
                   ]
                }
             ],
             "review":{
                "author":{
                   "@type":"Person",
                   "name":"Someone-Else"
                },
                "datePublished":"2020-05-12T20:07:23+07:00",
                "dateModified":"2020-05-29T17:40:21+07:00",
                "reviewRating":{
                   "@type":"Rating",
                   "ratingValue":"5",
                   "bestRating":"5",
                   "worstRating":1
                }
             },
             "image":{
                "@type":"ImageObject",
                "url":"https:\/\/www.domain.com\/wp-content\/uploads\/2020\/05\/my-new-book.png",
                "width":1200,
                "height":630
             }
          }
       ]
    }

    In this, I want change the author of “Someone” and “Someone-Else”
    Thanks

    Hello,

    Thank you for the follow up.

    The following filter should work. Please add it and let us know how it goes.

    add_filter( 'rank_math/snippet/rich_snippet_book_entity', function( $entity ) {
        $entity['author'] = [
    	'@type' => 'Person',
    	'name'  => 'Author Name',
        ];
    
        return $entity;
    });

    Looking forward to helping you. Thank you.

    ​​​​​​

    Foo
    Rank Math free

    Hi Micheal,
    Thank for your reply
    But it not work. It not change the: review author. I need change the Review Author Name, thank.

    “review”:{
    “author”:{
    “@type”:”Person”,
    “name”:”Someone-Else”
    },

    Hello,

    Thank you for contacting Rank Math today.

    The author value under review is generated from your WordPress User settings for the value you have set to show publicly as.
    img
    To change it you would have to change the that in WordPress > Users for the user posting

    Hope that helps and please do not hesitate to let us know if you need our assistance with anything else.

    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 8 replies - 1 through 8 (of 8 total)

The ticket ‘Change author value in json-ld’ is closed to new replies.