WordPress 5.7+Yoast: WP_Query override breaks SEO titles/description
-
We have code like this:
With WordPress 5.6, it correctly showed the redirected page as well as showed Titles/Descriptions from Yoast.
As soon as we upgraded to WordPress 5.7, Yoast no longer shows it’s SEO overrides in this case – instead we get random products displayed as title and description (and open graph).
function product_category_override() { global $wp_query; if ( is_product_category() ) { $page_override = get_field( 'page_override', 'category_' . get_queried_object()->term_id ); if ( $page_override ) { $wp_query = new WP_Query( [ 'page_id' => $page_override ] ); } } } add_action( 'template_redirect', __NAMESPACE__ . '\product_category_override' );
Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
- The topic ‘WordPress 5.7+Yoast: WP_Query override breaks SEO titles/description’ is closed to new replies.