Quantcast
Channel: Topic Tag: plugin | WordPress.org
Viewing all articles
Browse latest Browse all 26892

Aaron Wagner on "How to fire function after a menu is saved"

$
0
0

I ended up hooking into the admin_notices action, and then testing for certain conditions when my function fired.

Something along these lines:

add_action('admin_notices','my_function');
function my_function(){
  global $current_screen;
  if($current_screen == 'nav-menus' && isset($_POST['menu'])):
    #Update code here
  endif;
}

This basically allowed me to do some action after a menu was saved. It's perhaps not the *ideal* way to do it, but the menus are something that are only updated by admins (specifically, me), and done very seldom. In my specific case, the hook in the OP was too soon.


Viewing all articles
Browse latest Browse all 26892

Trending Articles