Reputation: 20464
What is the first php file wordpress goes to to determine what page, document or URL to load. I have some PHP I want executed to determine what happens when certain URL's are entered. At the moment it's in the 404.php for want of a better place.
This however is not ideal. The index.php in theme is not referenced so what is?
Upvotes: 0
Views: 234
Reputation: 1312
It's one of the many pages loaded from wp-settings.php. Anyway, you don't have to go that deep into the core structure and spoil WP's native functionality I think, you can do whatever you prefer in theme functions.php, so you can get a page name just by doing something like this in functions.php:
$pagename = get_query_var('pagename');
if ( !$pagename && $id > 0 ) {
$post = $wp_query->get_queried_object();
$pagename = $post->post_name;
}
Upvotes: 1