Hi again, @dreamon11!
Thanks for the feedback. It took me a little longer to process.
I was under the impression you also used the comments block. This is why sharing the site URL is important for debugging/support. ??
The patch I added to TSF 5.0.6 only bypasses a specific WordPress Core bug where build_comment_query_vars_from_block()
could run before wp_head()
, which overrides cpage
after the query was already established. It now appears that another function on your site is engaging the cpage
query variable outside of the standard API.
You’ll find that set_query_var()
is used sparsely in WordPress and only to patch one more lingering issue (coincidentally, also for cpage
). This is in comments_template()
(and wp_list_comments()
, but only after comments_template()
has done this).
With that, I think that your theme uses comments_template()
and parses that before wp_head()
runs, causing TSF to think we’re on a comment page.
This, then, is absolutely an edge case, but I think one more tiny adjustment in TSF could even account for that. Since you’re familiar with code, I want to ask you to adjust one single line in TSF at line 1201 of /inc/classes/helper/query.class.php
: https://github.com/sybrew/the-seo-framework/blob/5.0.6/inc/classes/helper/query.class.php#L1201.
There, please change this:
if ( \has_block( 'core/comments', Data\Post::get_content() ) ) {
to:
if ( true ) {
It’ll make TSF always consider the bypass instead of only for the FSE bug.
It already has some preliminary checks engaged to ensure we’re on a comment page: get_query_var( 'cpage' )
is above 0, did_action( 'parse_comment_query' )
is true, and is_singular()
is true.
Then, in the if ( true ) {
branch, it’ll test if $wp_query->cpage
is above 0, which affirms that cpage
is adjusted via set_query_var()
.
Before testing if this does the trick, be sure to disable your custom filter.
Lastly, although unlikely, if you always see the /comment-page-#/
part in the URL, note that I still permitted /comment-page-1/
to be blocked via noindex
because themes can behave unexpectedly by not always showing the content.