I'm building a site that has CPT that needs both pagination in archives and the single article (Like DPreview kind of thing; reviews broken down into pages) from a scraped old site. I have the single CPT pagination working now but this filter/query seems to strip the WP body class of the full array. Am I doing something obvious to cause this?
function review_subcategory_query($query) {
if ( isset( $query['post_type'] ) && 'review' == $query['post_type'] ) {
if ( isset( $query['review'] ) && $query['review'] && isset( $query['review-category'] ) && $query['review-category'] ) {
$query_old = $query;
if ( 'page' == $query['review-category'] ) {
$query['paged'] = $query['name'];
unset( $query['review-category'], $query['name'], $query['review'] );
}
$query['fields'] = 'ids';
$query['posts_per_page'] = 1;
$_query = new WP_Query( $query );
if ( ! $_query->posts ) {
$query = array( 'review-category' => $query['review'] );
if ( isset( $query_old['review-category'] ) && 'page' == $query_old['review-category'] ) {
$query['paged'] = $query_old['name'];
}
}
}
}
return $query;
}
add_filter( 'request', 'review_subcategory_query', 10 );
Removing that fixes the classes, with it in place the body class janks out ofter the CPT example: "-template-default single logged-in admin-bar customize-support"
All help is appreciated!