I’m implementing a custom author archive in WordPress where the author page lists posts based on custom meta fields (ACF user fields), not post_author.
What works
/author/author-slug/loads correctlyPage 1 shows the correct posts
Pagination links are generated correctly
What doesn’t work
/author/author-slug/page/2/returns 404 / ForbiddenWordPress code and rewrites seem correct
Pagination never reaches WordPress on page 2 in staging
Setup details
WordPress (Genesis-based theme, but not doing anything custom with Genesis loops)
Custom post type:
documentAuthor page shows documents where:
_dg_document_writer_id = author_idOR_dg_document_reviewer_id = author_id
Pagination size: 9
Code
Author template (author.php)
$paged = max( 1, get_query_var( 'paged' ) );
$q = new WP_Query([
'post_type' => 'document',
'post_status' => 'publish',
'posts_per_page' => 9,
'paged' => $paged,
'meta_query' => [
'relation' => 'OR',
[
'key' => '_dg_document_writer_id',
'value' => $author_id,
'compare' => 'LIKE',
],
[
'key' => '_dg_document_reviewer_id',
'value' => $author_id,
'compare' => 'LIKE',
],
],
]);
Pagination:
echo paginate_links([
'total' => max( 1, $q->max_num_pages ),
'current' => $paged,
'type' => 'list',
]);
Rewrite rule
add_action( 'init', function () {
add_rewrite_rule(
'^author/([^/]+)/page/([0-9]+)/?$',
'index.php?author_name=$matches[1]&paged=$matches[2]',
'top'
);
});
Permalinks flushed.
Debugging observations
Page 1 works
Page 2 never reaches WordPress
curl -I /author/slug/page/2/returns 403 ForbiddenResponse headers indicate the request is blocked before WordPress runs