Want to disable shop page on WooCommerce to protect categories? Use the below snippets to disable shop page on WooCommerce to protect categories.
1 2 3 4 5 6 7 8 9 | function woocommerce_disable_shop_page() { global $post; if (is_shop()): global $wp_query; $wp_query->set_404(); status_header(404); endif; } add_action( 'wp', 'woocommerce_disable_shop_page' ); |
If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.