Problem with multiple Custom Post Types on Archive Page Query
-
I’m trying to combine multiple post types on an archive page, however when I do so i get a bunch of errors all over the page. The actual archive listing works properly, it just seems to break everything else outside of the main query.
Error displayed on site, multiple times/places:
Warning: Illegal offset type in isset or empty in /home/.../wp-includes/post.php on line 1039
That line of code is:
if ( empty($wp_post_types[$post_type]) )
Code being used:
function archive_filter($query) { if ( !is_admin() && $query->is_main_query() && $query->is_archive) { if ($query->query_vars['post_type']=="jobpost" || $query->query_vars['post_type']=="hotjob"){ $query->query_vars['post_type']=array( 'hotjob','jobpost'); } } }
All post types have publicly_queryable and has_archive to true.
I’ve used the information on the codex page and even tried in a fresh install of both wordpress and theme.
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Problem with multiple Custom Post Types on Archive Page Query’ is closed to new replies.