WordPress.org

Ready to get started?Download WordPress

Forums

Hook for when user logs into admin area. (2 posts)

  1. s1ngular1ty
    Member
    Posted 1 year ago #

    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?

  2. s1ngular1ty
    Member
    Posted 1 year ago #

    Sorry wrong forum, i think. Ill repost this in hacks. Feel free to delete

Topic Closed

This topic has been closed to new replies.

About this Topic