Removing Woocommerce hook functions

Asked

Viewed 42 times

0

I have this code in my file template-homepage.php

<?php
            /**
             * Functions hooked in to homepage action
             *
             * @hooked storefront_homepage_content      - 10
             * @hooked storefront_product_categories    - 20
             * @hooked storefront_recent_products       - 30
             * @hooked storefront_featured_products     - 40
             * @hooked storefront_popular_products      - 50
             * @hooked storefront_on_sale_products      - 60
             * @hooked storefront_best_selling_products - 70
             */
            do_action( 'homepage' );
            ?>

I would like to remove the function storefront_product_categories of hook homepage. For this I created the following function, as explained in wordpress documentation.

  function remove_hook() {
        remove_action( 'homepage', 'storefront_product_categories', 20);
   } 
   add_action( 'homepage', 'remove_hook' 20);

But the action is still loaded normally on my page. I wonder if there is any way to remove this action through codes.

  • But it still appears on your homepage ? Or it is only loaded ?

  • Still appears..

  • Try removing from within the function, leaves only the line of remove_action in the functions.php file

  • Send your functions.php to get a better idea

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.