Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I have set up a custom post type and a custom taxonomy for it. I'm using the latest version of Wordpress. I believe I should be using the is_post_type_archive function, but this seems to be is returning false no matter what.

The post type I've set up is called articles and the taxonomy is called editions

I'm trying to access /editions/september and the archive page is showing, but the page title is showing as the first post's title. I can fix this if I can figure out how to write a conditional if statement to let me know I am in a custom post type custom taxonomy page. How can I achieve that?

share|improve this question

2 Answers 2

up vote 1 down vote accepted

Have you made sure your CPT is using the 'has_archive' => true, parameter? And try something like;

wp_reset_query(); 

 if (is_post_type_archive('articles')){
     // do something
    }
share|improve this answer

Following @Wyck, make sure has_archive is set to true while registering your post type.

share|improve this answer
    
As far as I can see, codex clearly says is_archive() does not accept any parameters. Source code backs that up. –  lkraav Jun 10 at 10:06
    
It could be true now, since I wrote this almost 3 years back! I'm unaware of the new source code. Can you update my answer? –  Rutwick Gangurde Jun 10 at 11:02

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.