Hello,
Please use the 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;
});
Hope that helps and please do not hesitate to let us know if you need our assistance with anything else.
Forgive my lack of knowledge, where should I enter the filter?
thank you
Hello,
You would need to insert the filter code in your theme’s functions.php file. We actually have a short article guide with regards to inserting filters to your site: https://rankmath.com/kb/wordpress-hooks-actions-filters/
Do note that the filter I provided is just a placeholder to show you the basics of modifying the author property of the schema.
You’ll need to edit the values as per your requirements to successfully change the article value.
Hope that helps and please do not hesitate to let us know if you need our assistance with anything else.
Ok, it worked correctly. I remove the @id attribute where the URL appears. But I need to replace that url that shows by default.
For example
“@id”: “https://midominio.com/author/nombre-author/”
with “@id”: “https://midominio.com/other-url custom/”
Is it possible?
thanx
Hello,
You can simply add value to the author array. Please refer to this modified filter:
add_filter( 'rank_math/snippet/rich_snippet_article_entity', function($entity) {
$entity['author'] = [
'@type' => 'Person',
'name' => 'Author Name',
'@id' => 'https://midominio.com/other-url-custom'
];
return $entity;
});
Hope that helps.
Looking forward to helping you.
sorry, but change the base of the url, but not the url
for example
mydomain.com/author/name
to
mydomain.com/new-base-url/name
thanks for your time
Hello,
You may need an expert to further customize the code to dynamically change the URL as Rank Math currently pulls the actual URL from the user page and use it as the URL for the author URL.
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.