post_type modification on archive pages only
-
I recently had some trouble with custom queries which always returned all kinds of posts although a specific type had been explicitly set. This was caused by the plugin behavior of setting the post_type for queries to “any” in general.
Wouldn’t it make sense to check if the queries are performed on an archive page before modifying the type? (This did the trick in my case.)
function tags_archives:
if ( is_archive() && $wp_query->get( ‘tag’ ) )…function category_archives:
if ( is_archive() && ( $wp_query->get( ‘category_name’ ) || $wp_query->get( ‘cat’ ) ) )…https://www.ads-software.com/plugins/post-tags-and-categories-for-pages/
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘post_type modification on archive pages only’ is closed to new replies.