Title: After save theme hook not working
Last modified: September 1, 2016

---

# After save theme hook not working

 *  Resolved [martnick](https://wordpress.org/support/users/martnick/)
 * (@martnick)
 * [9 years, 10 months ago](https://wordpress.org/support/topic/after-save-theme-hook-not-working/)
 * Hello, I can’t seem to hook up to the after save theme options hook. I am currently
   developing a theme with a site plugin. I have hooked like so in my functions.
   php:
 *     ```
       add_action('carbon_after_save_theme_options',
       'action_on_plugin_save',999,1);
       function action_on_plugin_save( $user_data) {
       	echo "<pre>";
       	var_dump( $user_data );
       	echo "</pre>";
       }
       ```
   
 * And like so in my plugin class:
 *     ```
       private function __define_roles_and_caps() {
        add_action('carbon_after_save_theme_options',               array($this,'action_on_plugin_save'));
       }
   
       public function action_on_plugin_save( $user_data) {
       	echo "<pre>";
       	var_dump( $user_data );
       	echo "</pre>";
       }
       ```
   
 * But it doesn’t print anything, and it still saves the changes. In the theme container,
   the is_valid_save() the main if statement returns false.
 * [https://wordpress.org/plugins/carbon-fields/](https://wordpress.org/plugins/carbon-fields/)

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

 *  Plugin Author [htmlBurger](https://wordpress.org/support/users/htmlburger/)
 * (@htmlburger)
 * [9 years, 10 months ago](https://wordpress.org/support/topic/after-save-theme-hook-not-working/#post-7634302)
 * Hi [@martnick](https://wordpress.org/support/users/martnick/),
 * The hook is actually firing at the proper time, but the `$user_data` part is 
   misleading because its not holding the actual user input. We will most likely
   remove that variable to avoid confusion.
 * If your goal is to retrieve the user input, try using the `$_POST` variable.
   
   Hope this helps.
 *  Thread Starter [martnick](https://wordpress.org/support/users/martnick/)
 * (@martnick)
 * [9 years, 10 months ago](https://wordpress.org/support/topic/after-save-theme-hook-not-working/#post-7634305)
 * Hello [@htmlburger](https://wordpress.org/support/users/htmlburger/),
 * How can I be sure that the hook is firing? It doesn’t print anything. If I am
   adding the containers after adding the hook, could that be the problem?
 *  Plugin Author [htmlBurger](https://wordpress.org/support/users/htmlburger/)
 * (@htmlburger)
 * [9 years, 10 months ago](https://wordpress.org/support/topic/after-save-theme-hook-not-working/#post-7634306)
 * [@martnick](https://wordpress.org/support/users/martnick/) Did you try adding
   an `exit;` after the closing `pre`?
 *  Thread Starter [martnick](https://wordpress.org/support/users/martnick/)
 * (@martnick)
 * [9 years, 10 months ago](https://wordpress.org/support/topic/after-save-theme-hook-not-working/#post-7634307)
 * [@htmlburger](https://wordpress.org/support/users/htmlburger/) No, I was dumb.
   With exit it works perfectly. Thanks!
 *  Plugin Author [htmlBurger](https://wordpress.org/support/users/htmlburger/)
 * (@htmlburger)
 * [9 years, 10 months ago](https://wordpress.org/support/topic/after-save-theme-hook-not-working/#post-7634308)
 * No problem, you are welcome!

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

The topic ‘After save theme hook not working’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/carbon-fields_cacbcc.svg)
 * [Carbon Fields](https://wordpress.org/plugins/carbon-fields/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/carbon-fields/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/carbon-fields/)
 * [Active Topics](https://wordpress.org/support/plugin/carbon-fields/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/carbon-fields/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/carbon-fields/reviews/)

## Tags

 * [Add action](https://wordpress.org/support/topic-tag/add-action/)

 * 5 replies
 * 2 participants
 * Last reply from: [htmlBurger](https://wordpress.org/support/users/htmlburger/)
 * Last activity: [9 years, 10 months ago](https://wordpress.org/support/topic/after-save-theme-hook-not-working/#post-7634308)
 * Status: resolved