Imported Events without Schema

#64415
  • Resolved Andreas Flick
    Rank Math pro
    Content AI Creator

    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?

    Thanks

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.

    ​​​​​​

    Andreas Flick
    Rank Math pro
    Content AI Creator

    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

    Alberto
    Rank Math business

    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.

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

The ticket ‘Imported Events without Schema’ is closed to new replies.