Action hook 'load-{$pagenow}'

in WP Core File wp-admin/admin.php at line 386

View Source

load-{$pagenow}

Action Hook
Description
Fires before a particular screen is loaded. The load-* hook fires in a number of contexts. This hook is for core screens. The dynamic portion of the hook name, `$pagenow`, is a global variable referring to the filename of the current screen, such as 'admin.php', 'post-new.php' etc. A complete hook for the latter would be 'load-post-new.php'.

Hook Information

File Location wp-admin/admin.php View on GitHub
Hook Type Action
Line Number 386

Hook Parameters

This hook doesn't accept any parameters.

Usage Examples

Basic Usage
<?php
// Hook into load-{$pagenow}
add_action('load-{$pagenow}', 'my_custom_function');

function my_custom_function() {
    // Your custom code here
}

Source Code Context

wp-admin/admin.php:386 - How this hook is used in WordPress core
<?php
 381  	 * 'post-new.php' etc. A complete hook for the latter would be
 382  	 * 'load-post-new.php'.
 383  	 *
 384  	 * @since 2.1.0
 385  	 */
 386  	do_action( "load-{$pagenow}" ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
 387  
 388  	/*
 389  	 * The following hooks are fired to ensure backward compatibility.
 390  	 * In all other cases, 'load-' . $pagenow should be used instead.
 391  	 */

PHP Documentation

<?php
/**
	 * Fires before a particular screen is loaded.
	 *
	 * The load-* hook fires in a number of contexts. This hook is for core screens.
	 *
	 * The dynamic portion of the hook name, `$pagenow`, is a global variable
	 * referring to the filename of the current screen, such as 'admin.php',
	 * 'post-new.php' etc. A complete hook for the latter would be
	 * 'load-post-new.php'.
	 *
	 * @since 2.1.0
	 */
Quick Info
  • Hook Type: Action
  • Parameters: 0
  • File: wp-admin/admin.php
Related Hooks

Related hooks will be displayed here in future updates.