Hello,
Thank you for contacting Rank Math today.
The data added into the field is created into JSON format, which is the format for schema markup, when the post is updated. To work around this, you can set your post default to be event in Rank math > Titles & Meta > Post then customize the following filter to change the schema data for each of the event posts you add.
**
* 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;
});
Looking forward to helping you. Thank you.
Hi.
Thank you. I added the code to the child-themes functions.php…
But I need further assistance.
I changed to:
rank_math/snippet/rich_snippet_event_entity
do i have to change
return $entity; to return termine;
termine = the custom post type.
Thanks
Hello,
You will need to customize the code my colleague shared with you.
The $entity would be the JSON so you would need to access the right property and modify it before returning it.
I would recommend you print or dump the $entity var to check the fields you want to modify.
Looking forward to help 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.