Site logo

Archived topic

Disable generatepress Schema only on Homepage

15 replies · Started by Sars on March 5, 2022

Viewing posts 1–15 of 16

Dear Team how to disable default generatepress schema on homepage.

Thank you


<?php if ( is_front_page() ) : ?>
add_filter( 'generate_schema_type', function($schema){
    if ( is_home() ) {
        $schema = '__return_false';
    }
    return $schema;
} );

<?php endif; ?>

Thanks a lot. Is this the correct Code @david

This:

add_filter( 'generate_schema_type', function($schema){
    if ( is_front_page() ) {
        $schema = '__return_false';
    }
    return $schema;
} );

Thanks David,
But I am unable to get this sentence:
You may need to change the conditional tag depending on what home page stating you have:

I am using a Masonry theme i think - https://nationalroofingsupply.ca

Thanks Ying for your help!

Glad to hear that :)

You are welcome!

I added the Code

But and did "Execute PHP" , but still I am seeing the Default Schema Ying

I used this code:

<?php if ( is_front_page() ) : ?>
add_filter( 'generate_schema_type', function($schema){
    if ( is_home() ) {
        $schema = '__return_false';
    }
    return $schema;
} );

<?php endif; ?>

Extremely sorry for consuming your time.

Thanks a lot. My mistake. It is working well now.

This archived topic is closed to new replies.