Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove pre_handle_404 filter #874

Merged
merged 3 commits into from
Nov 3, 2022

Conversation

maximomartinezsoria
Copy link
Contributor

Problem: non-existent paged author archives are not throwing a 404. For example: /author/slug/page/100000. Will load and be indexed by crawlers.

Others are having this problem too: #703

Problem: non-existent paged author archives are not throwing a 404. For example: /author/slug/page/100000. Will load and be indexed by crawlers.

Others are having this problem too: Automattic#703
@leogermani
Copy link
Contributor

This would add a regression. See #425 and 09a1c50

So what we need is:

We need to ensure the same behavior for regular users and Guest authors.

  • When you visit the authors's page, never return 404, even if the author or guest author do not have any posts yet
  • When you visit the author's page with paged in a range outside the range, return 404

I did a quick test here and if I think it's just a matter of surrounding that filter in a is_paged() check:

if ( ! is_paged() ) {
	add_filter( 'pre_handle_404', '__return_true' );
}

Bonus points if you are able to update the tests on test-author-queried-object.php to check for all these cases

@maximomartinezsoria
Copy link
Contributor Author

Thanks for your answer!

Gusts authors behavior matching core behavior is already tested so I just added a new test for pagination.

Copy link
Contributor

@leogermani leogermani left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants