To remove WooCommerce breadcrumbs in WordPress using the functions.php file, you can use the woocommerce_breadcrumb
filter hook. This hook allows you to modify or disable the breadcrumb function that is used by WooCommerce.
Here is an example of how you can use this hook to completely remove the breadcrumbs from WooCommerce pages:
// Remove Breadcrumbs in WooCommerce
// More snippets at wpunplugged.com
function remove_woocommerce_breadcrumbs() {
remove_action( 'woocommerce_before_main_content', 'woocommerce_breadcrumb', 20 );
}
add_action( 'init', 'remove_woocommerce_breadcrumbs' );
In this example, we are using the remove_action()
function to remove the woocommerce_breadcrumb
action that is responsible for displaying the breadcrumbs. This will completely remove the breadcrumbs from all WooCommerce pages.
It’s important to note that this code will only remove the breadcrumbs from the front-end of your site. If you want to remove the breadcrumbs from the back-end as well, you will need to use a plugin or additional code to do so.