Imported Events without Schema

  • Hi,

    we import our events from our event-ticket-system. The matching with the rank-math-fields works fine. But the schema-code is not visible. The Code appears after opening and saving the individual event-post. But with aprox. 200 events per import it does not work comfortable. Is there any solution?


Viewing 3 replies - 1 through 3 (of 3 total)
  • 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.



    Thank you. I added the code to the child-themes functions.php…
    But I need further assistance.

    I changed to:

    do i have to change

    return $entity; to return termine;

    termine = the custom post type.



    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.

Viewing 3 replies - 1 through 3 (of 3 total)

You must be logged in to reply to this ticket.