I am trying to remove a theme action for an elegant-themes theme using a child theme.. This works when I remove action after add_action code anywhere in the parent theme functions.php. However, it does not work when I add it from child theme functions.php.

remove_action ('after_setup_theme', 'et_pb_setup_theme' , 10);

Remove action has same priority 10 as the add action. Shouldn't it work?

add_action( 'after_setup_theme', 'et_pb_setup_theme' ); //parent theme add_action

3 Answers 3


As @cybmeta already pointed out, you are too early with your removal. So you have to defer the actual removal, for instance like so:

add_action( 'after_setup_theme', 'wpdev_170663_remove_parent_theme_stuff', 0 );

function wpdev_170663_remove_parent_theme_stuff() {

    remove_action( 'after_setup_theme', 'et_pb_setup_theme' );
  • Worked! I have been trying something similar, but my bad! Since I put a condition using has_action to check a still non-existent action in child functions.php, before remove_action it wasn't working!! Thanks a lot! function etn(){ if(has_action('after_setup_theme', 'et_pb_setup_theme')){ remove_action ('after_setup_theme', 'et_pb_setup_theme' ); } } add_action ('after_setup_theme', 'etn', 9); Commented Dec 9, 2014 at 11:18

The functions.php file of child themes is loaded right before the parent theme functions.php, so when you run remove_action in child theme, the action you are trying to remove doesn't exist beacuse it is added later.

  • 1
    ..but doesn't priority 10 and the hook after_setup_theme should take care of that? How should I do this anyway? Commented Dec 9, 2014 at 9:21
  • No, the priority argument is not for that. Simply you can not remove something that doesn't exist. In other words, (taken from codex) you cannot successfully remove the action before it has been added.
    – cybmeta
    Commented Dec 9, 2014 at 9:38
  • 1
    So, how is it possible to remove an action set by the parent theme?
    – Aerendir
    Commented May 27, 2017 at 15:21

Try (just change the names):

add_action( 'init' , 'myyy_remove' , 15 );
function myyy_remove() {
        remove_action('ACTION_NAME', 'my_function_name_Something'   ,11);
        remove_action('ACTION_NAME', 'my_function_name_Another'     ,11);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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