WordPress check if post or page or home page

Hi Guys,

Some times while developing a plugin we need to check whether a feature can be enabled or disabled based on if a webpage is a

  1. WordPress type: POST
  2. WordPress type: PAGE
  3. WordPress type: HOMEPAGE

There are few ways you can check that but here are some core wordpress function that I use to find our the page type.

Lets go through these one by one to see how we can utilize these functions

Check if type is PAGE

WordPress codex supply a function called is_page() you can use this function to identify if a post is a page. So confusing right! but you get the idea

Here is a quick usage of this function

above code will print ‘page‘ on the screen if its a page

For more information please check this link out



Check if type is POST

Alright then we need to check this too many a times.

WordPress codex supply a function called is_single() to identify if post type is POST

here is a quick usage to test it out

Above will print post if you are browsing a post.

More information can be found here


by the way is_post() has been deprecated and should not be used.

Check if type is HOME PAGE/Front page

This is a common occurrence with many plugins trying to do some really specific things on home page. Such as displaying ads etc.

WordPress supply two functions called is_front_page() and is_home()

Here is a quick usage on that.


Both of the above function will print home page when tested

is_front_page is based on Settings->Reading->Front page displays setting, if it is is set to “Your latest posts“, or when its set to “A static page” or “Front Page” value and the current Page being displayed is same as selected page this function returns true.

is_home on the other hand is something I would use.

To know more about these functions please visit





I hope this helps





  1. Is there any easy trick to check specific post or page view source option via browsers?

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.