Disable Schema Homepage only

#69050
Viewing 5 replies - 1 through 5 (of 5 total)
  • Alberto
    Rank Math business

    Hello,

    Thank you for contacting Rank Math and sorry for any inconvenience that might have been caused due to that.

    It seems like it might be pasted wrongly. Could you share here the code so we can check it?

    Looking forward to helping you. Thank you.

    ​​​​​​​

    Vlad
    Rank Math free

    Hi there alberto and thanks for replying.
    I pasted the code exactly as it is stated on the thred pointed out :

    `/**
    * Filter: Remove/modify schema data.
    *
    * @param array $return Array of json-ld data.
    */
    add_filter( ‘rank_math/json_ld’, function( $data, $json ) {

    return $data;
    }

    Do I need to add something to it ?
    I’d only want to disable schema completely from the homepage.

    Thanks a lot

    Alberto
    Rank Math business

    Hello,

    This should be the right code, could you check it?

    /**
     * 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 ) {
    	if(is_home()){
               return [];
            }
            return $data;
    }, 10, 2);

    Looking forward to help you.

    Vlad
    Rank Math free

    Thanks a lot for your answer.
    I’ve copied and pasted the code but unfortunately it did not work.
    I always have the code fo Organization in my homepage which I don’t want to have.

    Any help would be very welcome.
    thanks

    Hello,

    You can try using the following filter:

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

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

    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 5 replies - 1 through 5 (of 5 total)

The ticket ‘Disable Schema Homepage only’ is closed to new replies.