RSS

How To Find Current WordPress Post Type

05 Sep

While developing a wordpress theme or plugin, you may have to check if a current page loaded in wordpress admin dashboard belongs to a page, post or a custom post type. For that you can use the following code:

 

1
2
3
global $current_screen;
if( ‘[your-post-type]’ == $current_screen->post_type )
//do something

 

Here ‘you-post-type’ can be ‘post’, ‘page’ or any other created custom post type.

Advertisements
 
11 Comments

Posted by on September 5, 2013 in Wordpress

 

11 responses to “How To Find Current WordPress Post Type

  1. arendatoru

    September 6, 2013 at 11:10 am

    Аренда квартир в Киеве обычно является тяжелым выбором. Новичок в аренде, который желает арендовать жилую площадь в Киеве на несколько месяцев, позвонив десяткам посредников понимает то, что разыскать лучший вариант длительной аренды VIP квартиры в Киеве – это весьма сложно. Вся сложность в том, что предложений по сдаче жилья на рынке очень большое количество и аредатор буквально запутывается в куче объявлений.
    Обратите внимание, что за те же средства реально арендовать жильё абсолютно разного класса. Опытные сотрудники фирмы Сдам Квартиру длительное время успешно работают на рынке недвижимости в Киеве по запросу клиентов, что позволило обрести обширную базу данных квартир с фото в аренду долгосрочно в Киеве. Поможем сдать Вашу квартиру !

    Посетите наш сайт Аренда элитных квартир в Киеве

    http://sdamkvartiry.com/ Аренда квартир в Киеве

     
  2. Carroll

    September 10, 2013 at 8:47 am

    I do not even know how I ended up here, but I thought this post was great. I don’t know who you are but certainly you’re going to a famous blogger if you aren’t already 😉 Cheers!

     
  3. Jeremy

    September 14, 2013 at 7:44 am

    Thank you for the good writeup. It actually used to be a amusement account it. Glance complicated to more delivered agreeable from you! By the way, how could we be in contact?

     
  4. Ismael

    September 15, 2013 at 4:15 am

    I drop a comment each time I especially enjoy a article on a blog or I have something to add to the conversation. Usually it’s triggered by the passion displayed in the post I browsed. And after this post How To Find Current WordPress Post Type | logichacker. I was moved enough to drop a thought 😛 I do have 2 questions for you if you don’t mind. Is it only me or do some of the remarks look like they are coming from brain dead visitors? 😛 And, if you are writing on additional places, I would like to follow everything new you have to post. Would you make a list every one of all your social pages like your Facebook page, twitter feed, or linkedin profile?

     
  5. Tobias

    September 15, 2013 at 7:16 am

    Hello there! I know this is kinda off topic however , I’d figured I’d ask. Would you be interested in trading links or maybe guest authoring a blog post or vice-versa? My site goes over a lot of the same topics as yours and I believe we could greatly benefit from each other. If you are interested feel free to shoot me an e-mail. I look forward to hearing from you! Superb blog by the way!

     
  6. Lincoln

    September 15, 2013 at 12:49 pm

    Trouver du cul film porn hub

     
  7. Wilbert

    September 16, 2013 at 5:38 pm

    I am genuinely happy to read this blog posts which carries lots of valuable facts, thanks for providing these data.

     
  8. Kareem

    September 17, 2013 at 10:35 am

    Hi there, yes this paragraph is actually nice and I have learned lot of things from it about blogging. thanks.

     
  9. Wilbert

    September 17, 2013 at 8:20 pm

    Hello, this weekend is good in support of me, as this time i am reading this wonderful educational paragraph here at my home.

     

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: