Site logo

Archived topic

Issue with Query Loop block on the front-end

21 replies · Started by Yerai on December 28, 2022

Viewing posts 16–22 of 22

Can I see your site?

Of course, I have left the access in the private area

Can you try this PHP snippet instead?

add_filter('request', function( array $query_vars ) {
    if ( is_admin() ) {
        return $query_vars;
    }
   if (! is_single()){
    if ( isset( $query_vars['category_name'] ) ) {
        $pagename = $query_vars['category_name'];

        $query_vars == array( 'pagename' => "$pagename" );
    }

    return $query_vars;
	   }
	return $query_vars;
} );

Hi Ying,

That snippet works.

Posts right now look how they should. But now category pages aren't replaced by a static page :(

Is there a way to fix that issue?

Can you disable the Strip Category Base option in Rank math?

I seems it now works well, thank you Ying!

Glad to hear that :)

This archived topic is closed to new replies.