WordPress: If Custom Post Type Is Equal To

Last updated on

We can use the is_singular function to detect the name of the current custom post type in our template.

if (is_singular('custom_post_type_name')) {

    echo "Custom post type!";

1 Star2 Stars3 Stars4 Stars5 Stars

Let me know if this helped. Follow me on Twitter, Facebook and YouTube, or 🍊 buy me a smoothie.

p.s. I increased my AdSense revenue by 68% using AI 🤖. Read my Ezoic review to find out how.

Leave a Reply

Notify of