Pagination for author archive subpage seen as page
-
I have changed the permalink for author pages from author to member, because we use the archive page as a profile page.
I used this function for it:
function change_author_permalinks() { global $wp_rewrite; $wp_rewrite->author_base = 'member'; $wp_rewrite->flush_rules(); } add_action( 'init', 'change_author_permalinks' );
That works as expected.
Result https://domain.com/member/author-name/I then wanted to create subpages for the author so I rewrote the address of any subpages and showed content accordingly to a query var.
I used this code for it:
function idf_rewrite_profile_pages() { add_rewrite_rule( 'member/([a-z-]+)/([a-z-]+)/?$', 'index.php?author_name=$matches[1]&subpage=$matches[2]', 'top' ); } add_filter( 'init', 'idf_rewrite_profile_pages', 1, 3 );
That also works as expected.
Result https://domain.com/member/author-name/name-subpage/I created a subpage named ‘written’ on which I list the loop/first page of posts:
https://domain.com/member/author-name/written/.That works.
Paging is activated and links https://domain.com/member/author-name/writte/page/2/ (as expected).
The query for the subpage ‘written’: author_name=[name of author]&subpage=written
If I check the query for the paged subpage of written the query is: paged=2&pagename=member%2F[author name]%2Fsubpage=writtenI would expect it be something like: paged=[page number]&author_name=[author name]&subpage=written
How do I make my archive sub-pages work on a rewritten subpage/url ?
- The topic ‘Pagination for author archive subpage seen as page’ is closed to new replies.