custom schema structure

  • Hello.
    I want to use a structure like the one below. How can I do it?

    for example homepage schema:

    *@type WebPage
    ****isPartOf
    ***********@type WebSite
    ***********publisher
    **********************@type Person
    **********************@type Organization
    ****about
    ***********@type Person
    ***********@type Organization

Viewing 1 replies (of 1 total)
  • Hello,

    Thank you for contacting Rank Math today.

    You can easily remove the Rank Math schema by making use of the following filter on your theme’s functions.php file:

    /**
     * Code to remove json+ld data
     * 
     */
    add_action( 'rank_math/head', function() {
    	global $wp_filter;
    	if ( isset( $wp_filter["rank_math/json_ld"] ) ) {
    		unset( $wp_filter["rank_math/json_ld"] );
    	}
    });

    Next, you can generate your custom schema and add it to head section of your site by using the following filter:

    /**
     * Collect data to output in JSON-LD.
     *
     * @param array  $unsigned An array of data to output in json-ld.
     * @param JsonLD $unsigned JsonLD instance.
     */
    add_filter( 'rank_math/json_ld', function( $data, $jsonld ) {
    	return [];
    }, 10, 2);

    Looking forward to helping you. Thank you.

    ​​​​​​

Viewing 1 replies (of 1 total)

You must be logged in to reply to this ticket.