Instantly share code, notes, and snippets.
schemapress/schema-wp-breadcrumb-enable.php
Last active Oct 20, 2017
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