Detecting If The Current Page Is A Post Or A Page
-
I’m trying to add an option to a plugin that limits an action to posts, pages or both. When the setting is set to “posts” I want to check the current page to see if it’s a post or a page. I’m using the following if statement:
if ( ($current_options["page_type"] == "posts") && ( !is_page() ) )
In other if we’re set for posts only AND the current page is not a page (meaning it’s a post) then execute the following code. When I load a page in the browser the the code still executes. I’ve tried adding wp_reset_query(); before the if statement but it still doesn’t work.
Any ideas how I can properly detect if I’m in a page or post?
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Detecting If The Current Page Is A Post Or A Page’ is closed to new replies.