I'm creating a plugin to remove some WooCommerces action, but my plugins seems not loading in the front page, only in admin page.

Code is like this:

remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_price');

I added die('something is wrog'); in the code, just to make sure the plugin is working, but that message is showing up only in the admin page.

What I need to do to my plugin to affect front page?


If your intent is to remove that function/action only on the front page (not clear from your question), then this code

    if (is_front_page) {
       remove_action( 'woocommerce_single_product_summary',


This code needs to be outside of the 'admin' code area of the plugin. See this link for documentation on is_front_page() https://codex.wordpress.org/Function_Reference/is_front_page

If that is not your question, then please edit your question to provide more detail.

  • My front page seems like not detecting existence of my plugin, only admin is reacting, no matter what function I call. – Lai32290 Sep 16 '17 at 14:11
  • My first guess is that there is no 'hook' in your plugin to add the plugins functionality to a page/post. Take a look at the "WordPress Plugin Hooks" section of codex.wordpress.org/Writing_a_Plugin , and the other pages linked on that page. Somewhere in your plugin there needs to be a 'hook' that will let the plugin do something on a post/page. – Rick Hellewell Sep 16 '17 at 17:50
  • I'm guessing the same, I'll take a look at the documentation, then I'll let you know my results, thanks! – Lai32290 Sep 18 '17 at 12:18
  • As I tested, my plugin is affecting front page, but just not affecting WooCommerce product's page – Lai32290 Sep 19 '17 at 10:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.