Skip to content

Instantly share code, notes, and snippets.

@schemapress
Last active October 20, 2017 22:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save schemapress/e76ca84bdc7e9ff5473997174cc5f016 to your computer and use it in GitHub Desktop.
Save schemapress/e76ca84bdc7e9ff5473997174cc5f016 to your computer and use it in GitHub Desktop.
Disable Schema plugin breadcrumbs https://schema.press/docs/breadcrumb-output/
<?php //* do not include php tag
/*
* A few ways to disable Schema plugin breadcrumbs json-ld output
*
* @since 1.6.9.5
*/
//------------------- (1)
//
// This will add a filter on `schema_wp_breadcrumb_enabled` that returns false
add_filter( 'schema_wp_breadcrumb_enabled', '__return_false' );
//------------------- (2)
//
// This will add a filter on `schema_wp_breadcrumb_enabled` that returns false
// but allow you to something in the function (see next function #3 for example)
add_filter( 'schema_wp_breadcrumb_enabled', 'schema_wp_breadcrumb_disable_238746' );
/*
* Disable breadcrumbs
*
* @since 1.6.9.5
*/
function schema_wp_breadcrumb_disable_238746( $breadcrumb_enabled ){
return false;
}
//------------------- (3)
//
// This will add a filter on `schema_wp_breadcrumb_enabled` that returns false,
// This example will disable breadcrumbs on WooCommerce
add_filter( 'schema_wp_breadcrumb_enabled', 'schema_wp_breadcrumb_woo_product_disable' );
/*
* Disable breadcrumbs on WooCommerce
*
* @since 1.6.9.5
*/
function schema_wp_breadcrumb_woo_product_disable( $breadcrumb_enabled ){
if ( class_exists( 'woocommerce' ) ) {
if ( is_woocommerce() ) return false;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment