get page/post ID in functions.php file
-
hello,
is there any way how to get page/post ID in functions.php file?
this code
global $wp_query; $postid = $wp_query->post->ID;
doesn’t work for me, i dumped $wp_query variable after “globalizing” and this variable looks like empty
[query] => [query_vars] => Array ( ) [queried_object] => [queried_object_id] => [request] => [posts] => [post_count] => 0 [current_post] => -1 . . . . . . . . .
thanks for help
Viewing 10 replies - 1 through 10 (of 10 total)
Viewing 10 replies - 1 through 10 (of 10 total)
- The topic ‘get page/post ID in functions.php file’ is closed to new replies.