I'm creating a child theme from Storefront.

Now I want to remove these action in child theme

add_action( 'woocommerce_before_shop_loop','storefront_sorting_wrapper',9 );

by this function:

add_action( 'after_setup_theme','remove_action', 100 );
  function remove_action() {
    remove_action( 'init', 'woocommerce_before_shop_loop');

but it doesn't work!


For removing an action hook you should use the same action name, callback name and the priority that was used to add a action in parent theme. And register it on init

add_action( 'init', 'remove_my_action');
function remove_my_action() {
     remove_action( 'woocommerce_before_shop_loop','storefront_sorting_wrapper',9 );

Read about remove_action


@Sumit is right, but if you call your function remove_action() Wordpress will throw an error. So this will work:

add_action( 'init', 'remove_actions_parent_theme');

function remove_actions_parent_theme() {
     remove_action( 'storefront_header','storefront_skip_links',0 );
  • Thanks for the notice @Drik corrected. I just copied from OP :D – Sumit May 4 '18 at 18:13

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.