[wp-hackers] Is this a bug? - is_archive()

Robert Lusby nanogwp at gmail.com
Mon Oct 17 15:14:20 UTC 2011


I have two seperate custom post types - let's call them 'books' and 'fruit'.

They both have 'has_archive' set to true, and slugs of:
/books/ and /fruit/

In functions.php, I'm calling the following:
if (is_archive('books')) {
     die("true");
}

Which returns true at:
http://www.example.com/books/
[expected behaviour]

It *also* however returns true at:
http://www.example.com/fruit/
[unexpected behaviour when using the post_types parameter]

This is using the latest version of WP.

Am I missing something?

For ref: http://codex.wordpress.org/Function_Reference/is_archive

Thanks,
Rob


More information about the wp-hackers mailing list