• Resolved DrMosko

    (@drmosko)


    hi all
    when is wp_loaded initiated?
    1.when admin enter the site or not?
    2.when user enter the site or not?

    I use this script:

    // add update check when admin login
    if (is_admin()) {
    	function wp_plugin_update() {
    			include( plugin_dir_path( __FILE__ ) . 'wp-plugin-update.php');
    	}
    	add_action( 'admin_init', 'wp_shabbat_update' );
    }
    // add update check when user enter the site after footer loaded
    if (!(is_admin() )) {
        function wp_plugin_update() {
    		include( plugin_dir_path( __FILE__ ) . 'wp-plugin-update.php');
    		}
    	add_action( 'wp_loaded', 'wp_plugin_update' );
    }

    can I only use this and it will work with admin and when user enter the site? :

    function wp_plugin_update() {
    		include( plugin_dir_path( __FILE__ ) . 'wp-plugin-update.php');
    		}
    add_action( 'wp_loaded', 'wp_plugin_update' );
Viewing 1 replies (of 1 total)
  • Thread Starter DrMosko

    (@drmosko)

    wp_loaded action is triggered in admin and in frontend no matter what user visits the site, it is triggered even for guest users.

Viewing 1 replies (of 1 total)
  • The topic ‘when is wp_loaded initiated’ is closed to new replies.