Linked Questions

67 votes
6 answers

How to get WordPress' hooks/actions run sequence?

In what order add_action hooks execute? i.e. init wp_head wp_footer after_theme_setup etc... ??? ??? ??? EDIT: I've also posted my solution.
T.Todua's user avatar
  • 5,810
71 votes
5 answers

Is there a flowchart for WordPress loading sequence?

So like WP must load series of files from, index.php -> ... -> wp-header.php -> ... ->functions.php ...and so on upon execution. Also there must be a similar flowchart for functions ...
laggingreflex's user avatar
23 votes
3 answers

What is the very earliest action hook you can call?

After the solution to this question was to get a function to launch BEFORE the init action is fired by taking the sequence out of its function, it got me thinking, is there any earlier in the WP load ...
Mild Fuzz's user avatar
  • 4,180
10 votes
4 answers

Consuming an external API in WordPress?

I have a client who has a WordPress website, and he want to extend it to add new functionalities. These functionalities are included in a website I have already done (a kind of search engine over a ...
tahir's user avatar
  • 203
5 votes
2 answers

When and Where is `global $post` Set and Available?

Usually when people think of the global $post object it's assumed that it's actually set whenever you enter The Loop. I started to play around with how early I could actually call global $post which ...
Howdy_McGee's user avatar
  • 20.7k
0 votes
2 answers

What is the proper way to get logged in user id in a plugin?

I need to get logged in user id inside my plugin. Is this the proper way? $root = dirname(dirname(dirname(dirname(__FILE__)))); if (file_exists($root.'/wp-load.php')) { require_once($root.'/wp-load....
PrivateUser's user avatar
  • 3,459
2 votes
2 answers

WordPress classes explained

Are there any books, websites or lectures that explain the built-in WordPress classes? I would really like to learn how WordPress works internally. I've dug up the core files on trac and even went ...
Siddharth Thevaril's user avatar
2 votes
4 answers

How does WordPress call functions attached to a certain action hook before calling functions attached to other hooks

We know that there is a certain order for the execution of callback functions attached to action hooks. How does WordPress decide which action should be prioritized while executing all the hooks?
IAmDhar's user avatar
  • 96
3 votes
2 answers

Which functions in theme or plugin load first

I created a plugin to override a theme's function. As I learn that function in plugin loads first but I got an error Fatal error: Cannot redeclare wooc_extra_register_fields() (previously ...
user2834491's user avatar
4 votes
2 answers

$wp_query initiation?

I'm wondering when does WordPress initiate its main query which sets the global $wp_query and enable us to use has_posts() and the_post() functions. If I create a page using archive template, how does ...
TurtleTread's user avatar
0 votes
1 answer

how does the rendering works?

i am trying to get a rough idea about how Wordpress renders the final content, built-in and plugin content. Rendering means to me, manipulating direct or indirect(delay via ajax,..) the DOM. To keep ...
stackoverclan's user avatar
3 votes
1 answer

Authoritative answer on which boots first - Plugins or Themes?

I can't seem to find anywhere in the WordPress documentation an authoritative answer on the question on whether a WordPress plugin boots first or whether a WordPress theme boots first. I need to know ...
Sophia_ES's user avatar
  • 155
1 vote
2 answers

What is the callback sent to add_submenu_page() invoked by WordPress?

WordPress tries to be event driven with all it's actions and filters you can hook to. But it also has special functions to create admin pages such as add_submenu_page() which accepts a (callback) $...
Jorge Orpinel Pérez's user avatar
8 votes
1 answer

PHP code in page template vs functions

I've made numerous WordPress sites, and learned PHP practices that I believe to be right, i.e. functions go in functions.php file, nearly everything in functions.php should be wrapped in a function, ...
tmdesigned's user avatar
  • 1,675
0 votes
1 answer

Why can't a custom postype be registered with "admin_init" hook?

Why do I need to use the "init" hook instead of the "admin_init" hook? init:fires after the core of the wordpress is loaded but before headers are sent admin init:before any other hook when the user ...
Johnthomas's user avatar

15 30 50 per page