Title: Run child function after parent theme function if parent using after_setup_theme
Last modified: August 21, 2016

---

# Run child function after parent theme function if parent using after_setup_theme

 *  Resolved [s0what](https://wordpress.org/support/users/s0what/)
 * (@s0what)
 * [12 years, 4 months ago](https://wordpress.org/support/topic/run-child-function-after-parent-theme-function-if-parent-using-after_setup_theme/)
 * Hi!
 * I need to modify one theme which isn’t built very smart.
    I need to override (
   remove) this action using child theme `add_action( 'after_setup_theme' , 'setup_theme');`
 * I tried to do following, but it doesn’t work:
 *     ```
       add_action('init','remove_setup_theme');
           function remove_setup_theme(){
               $status = remove_action( 'after_setup_theme' , 'setup_theme' );
               if ($status) {
                   echo(' setup_theme removed');
               } else wp_die(' setup_theme not removed');
           }
       ```
   
 * And it always dies 🙁
    Please help!

Viewing 4 replies - 1 through 4 (of 4 total)

 *  [Sumit Singh](https://wordpress.org/support/users/5um17/)
 * (@5um17)
 * [12 years, 4 months ago](https://wordpress.org/support/topic/run-child-function-after-parent-theme-function-if-parent-using-after_setup_theme/#post-4526826)
 * Hi,
 * Try this code
 *     ```
       add_action('after_setup_theme','remove_setup_theme');
       function remove_setup_theme(){
           $status = remove_action( 'after_setup_theme' , 'setup_theme', 1 );
           if ($status) {
               echo(' setup_theme removed');
           } else {
               wp_die(' setup_theme not removed');
           }
       }
       ```
   
 *  [Sumit Singh](https://wordpress.org/support/users/5um17/)
 * (@5um17)
 * [12 years, 4 months ago](https://wordpress.org/support/topic/run-child-function-after-parent-theme-function-if-parent-using-after_setup_theme/#post-4526834)
 * because **init** called after **after_setup_theme** so parent theme action called
   before your remove action.
 *  Thread Starter [s0what](https://wordpress.org/support/users/s0what/)
 * (@s0what)
 * [12 years, 4 months ago](https://wordpress.org/support/topic/run-child-function-after-parent-theme-function-if-parent-using-after_setup_theme/#post-4526890)
 * Thanks! It worked, but I had to add priority to add_action not remove_action 
   🙂
 *  [Sumit Singh](https://wordpress.org/support/users/5um17/)
 * (@5um17)
 * [12 years, 4 months ago](https://wordpress.org/support/topic/run-child-function-after-parent-theme-function-if-parent-using-after_setup_theme/#post-4526896)
 * Same thing both are same hooks not an issue 😉

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Run child function after parent theme function if parent using after_setup_theme’
is closed to new replies.

 * 4 replies
 * 2 participants
 * Last reply from: [Sumit Singh](https://wordpress.org/support/users/5um17/)
 * Last activity: [12 years, 4 months ago](https://wordpress.org/support/topic/run-child-function-after-parent-theme-function-if-parent-using-after_setup_theme/#post-4526896)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
