remove_action is not working for me to remove a theme's action..?

Viewed 50

I'm running WordPress + WooCommerce + Storefront. I'm trying to remove the "Built with Storefront & WooCommerce" credit in the footer.

I see lots of articles explaining how to do that by using remove_action as follows:

remove_action('storefront_footer', 'storefront_credit',20);

This is not working, though. I've tried it through a Snippets plugin, and I've tried it through the functions.php in my child theme.

I've also verified that nothing seems to have changed in the theme code since these articles were written, so it has the same function and hook names.

I'm not sure what I'm missing here..?? Any information on this would be greatly appreciated. Thanks!

1 Answers

In order to remove the action you must be sure to remove it before it's added. This is a parent theme's hook, so if you remove_action from the child theme or via code Snippets, it's already too late.

Unless... you make the remove_action trigger earlier, by hooking that to "wp" WordPress action.

Try with:

add_action( 'wp', 'bbloomer_remove_storefront_actions' );

function bbloomer_remove_storefront_actions() {
   remove_action( 'storefront_footer', 'storefront_credit', 20 );
}
Related