I set static page as front page.
I need to know if user currently on homepage in my custom plugin.
Functions is_home() and is_front_page() doesn’t works, since homepage is static page.
I can get an id of this page :
$frontpage_id = get_option('page_on_front');
But how to get id of current page from admin plugin? (Then i’ll be able to compare those ids and detect if current page is homepage!)
2 vancoder
Code:
1) Set any static page as frontpage.
2) Create dummy plugin
3) Code of plugin :
$d = is_front_page();
var_dump($d);
==>
bool(false)
UPD
http://codex.wordpress.org/Conditional_Tags#The_Front_Page
should work, by didn’t
2 Vancoder
Admin plugin means just plugin 🙂 sorry
And those two lines is all context for now, try it yourself, it doesn’t works.
WP version 3.3.2
This is why I asked for more code context. I’ll have to guess that you are checking for the front page outside of any hooked function, or inside a function that is called too early, before is_front_page() is ready.
The following will work.
I guess you are talking about the editor screen? If so, you can use the global variable
$post_ID
: