• I’m looking for a hook that will run once and once only when someone logs into the admin area. However I do not want the hook to run, after the intial login, when a new page within the admin area is loaded.

    From the description I thought admin_init should work like this:

    admin_init is triggered before any other hook when a user access the admin area.

    However in the implementation I have shown below, my plugin options are being updated everytime a new page loads in the admin area.

    add_action( 'admin_init', 'zmb_plugin_admin_init' );
    function zmb_plugin_admin_init() {
      update_option('zmbShownSalesFrom','2013-01-01' );
      update_option('zmbShownSalesTo',  date('Y-m-d'));
    }

    Can someone suggest a way to have these options update only on the intial login?

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Hook for when user logs into admin area.’ is closed to new replies.