The the_post action is called whenever a post is displayed. What action is the best to use when the main page/post loads?
Thanks
The the_post action is called whenever a post is displayed. What action is the best to use when the main page/post loads?
Thanks
Comments are closed.
There is no specific action for the main page but depending on your needs you can hook
the_post
and call the functionis_home
oris_front_page
to determine if the main page is currently being viewed.Available actions are listed here. Depending on what you want to do with the main page and when, you can hook
the_post
, or possiblewp
,wp_head
,get_header
to run the check for the main page and run your code if that condition is met.