Schema on archive page

#221766
  • Resolved nebuso
    Rank Math pro

    How to handle a case like this:

    I created a Custom Post Type that is supposed to be a Course.
    Each post is a lesson.

    I created a Custom Post Type that is meant to be a Podcast Playlist.
    Each entry is an episode.
    I know that podcasts are handled via XML, but I’m talking about showing a situation where we have a very extensive archive/taxonomy that is meaningful in its own right.
    Like for example in Courses.

    The individual entries I can set up nicely, I don’t know how to change the Type for archive/tags of my custom post type.
    Is there a hook/filter to change the data just before display?
    https://rankmath.com/kb/filters-hooks-api-developer/

    Dawid

Viewing 2 replies - 1 through 2 (of 2 total)
  • 
    /**
     * Filter: Remove/modify schema data. 
     * @param array $return Array of json-ld data.
     */
    
    add_filter( 'rank_math/json_ld', function( $data, $json ) 
    {
    if( is_home() ) 
    {  
    error_log( print_r( $data, true) );
    }
    return $data;
    }
    

    Hello,

    Thank you for contacting the support, and sorry for the delay and any inconvenience that might have been caused due to that.

    I can see that you already marked this ticket as resolved. Just to add, the code you added above will help in modifying schema data, but that function is already accessible through Rank Math PRO’s Schema Template feature, which allows you to create Schema Templates and assign them to the CPT category.

    For additional information, please follow this KB on Schema Templates: https://rankmath.com/kb/schema-templates/.

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

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

You must be logged in to reply to this ticket.