0

I am new at wordpress. I found a hook in theme back-combat.php file which is prevents to load previous version of wordpress for current theme customization. such as

add_action('load-customize.php', 'my_function_name');

My question is what is this hook and from where it is loaded because load-customize.php

and which way I can learn quick about wordpress core and learning plugin development?

1 Answer 1

1

This is from a dynamic hook that's generated in the wp-admin/admin.php file and fires right after the admin_init action.

Here's the inline documentation for the core screens part:

/**
 * 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 page, such as 'admin.php',
 * 'post-new.php' etc. A complete hook for the latter would be
 * 'load-post-new.php'.
 *
 * @since 2.1.0
 */
 do_action( "load-{$pagenow}" );

When we visit /wp-admin/customize.php the generated action is load-customize.php.

We can then e.g. check if it has already been fired with:

did_action( 'load-customize.php' );

that returns the number of times it has fired so far, during the page load.

Check the code reference for more info on did_action().

Another example is the wp-admin/edit.php and the corresponding load-edit.php action.

1
  • you're welcome, glad to hear it helped. @Roni
    – birgire
    Feb 7, 2017 at 18:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.