• Resolved betic0

    (@betic0)


    I’m trying to disable the plugin for a given custom post type. The use case is: I’m creating a listing based on custom post types retrieved by the DB via new WP_Query and then iterating. The issue I have is that I’m getting the starts added in each and every element from the loop, resulting in many schemas in the same web.

    With

    add_filter('yasr_filter_schema_jsonld', function () {return false;});

    I get an empty application/ld+json script but I would like to get rid off it completely.

    <script type="application/ld+json"></script>

    What could I do to either disable the plugin for those specific custom post types or remove the script from by applying some filter somehow?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Contributor dudo

    (@dudo)

    Hello, you can use this code to totally disable the rich snippets:

    global $yasr_additional_rich_fields;
    remove_action( 'the_content', array( $yasr_additional_rich_fields, 'addSchema' ), 99);

    Best,
    Dario

    Thread Starter betic0

    (@betic0)

    It worked like a charm! Thank you

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Disable yasr from code’ is closed to new replies.