Target only single product page

I assume you mean to use this on a single product’s page, right? If so, try this: add_action(‘admin_head’, ‘wwc_my_custom_css’); function wwc_my_custom_css() { if (!current_user_can(‘edit_pages’){ global $post; $isProduct = $post->post_type == ‘product’; // use the actual name for product if ($isProduct ) { echo ‘<style> #mceu_27-body, #wp-content-editor-tools{ display:none !important; } </style>’; } } }

How to allow WordPress to recognize a custom URL segment after a product URL and use a custom template?

Looks like all I needed to do was put the template_include filter inside of the init action. Source: https://stackoverflow.com/a/50037707/5749974 add_action( ‘init’, function () { $product_base = ltrim( get_option( ‘woocommerce_permalinks’ )[ ‘product_base’ ], “https://wordpress.stackexchange.com/” ); add_rewrite_rule( “{$product_base}/([^/]+)/test”, ‘index.php?product=$matches[1]&test=1’, ‘top’ ); add_filter( ‘template_include’, function( $template ) { if ( get_query_var( ‘test’ ) ) { $template = get_stylesheet_directory() … Read more