After a bit of digging over the weekend, I found the solution and indeed, it is a rewrite rule with the paged variable added
add_rewrite_rule('collection/men/page/([^/]+)/?$','index.php?post_type=collection&men=yes&paged=$matches[1]','top');
Pagination now works in the custom template loaded by query variable. i.e. localhost/sample-site/collection/men/page/2 loads the next page instead of a 404 error
Related Posts:
- How to create custom URL routes?
- Change the “page” slug in pagination
- Passing parameters to a custom page template using clean urls
- Problem with add_rewrite_rule and pagination (paged and page query_vars)
- Using a page template without a page
- Create built-in pages without creating actual pages
- Disable wordpress pagination URL rewrite for specific page
- add_rewrite_rule not working for page var
- URL rewrites and pagination
- Rewrite Rule for Custom Page with Query Vars in URL
- Sorting archive pages with “pretty” URLs?
- custom template for custom url
- add_rewrite_rule and pagination issue
- WordPress removes spaces in URL on pagination
- WordPress rewrite rules for state and city
- How to remove WordPress category from URL and have a custom pagination parameter/rewrite?
- Remove “/page/1” from the URL
- Disable Pagination on Pages
- Load an url with minimal/no DB queries
- Custom rewrite_rules – only pass numbers and not alphabetic characters
- Changed pagination URLS to use p= instead of paged=
- Custom rewrite causes 404 on pagination
- URL rewriting with custom user meta “/%shop_name%/gallery/%gallery%”
- Adding a rewrite rule to page that has no fixed variables and pagination
- Integer based rewrite isn’t recognized for value of 1
- Not able to rewrite the pagination URL for the posts
- How can I create custom URL routes?
- Rewrite rule shows 404 page
- Why is a rewrite rule in wordpress prevent pagination?
- Query vars to return the homepage
- How to allow WordPress to recognize a custom URL segment after a product URL and use a custom template?
- WordPress pagination broken for page 2,3 with custom permalink. Redirects to baseurl
- Rewrite query var on postname
- URL rewrite before template_redirect called
- Remove trailing slash
- Redirect if string found in URL
- Pagination posts. Url format
- WordPress total posts per page changed and now 404 Http error comes out [closed]
- Wrong rewrite rules
- Need help with regex
- WordPress is adding pagination for all pages like www.example.com/page/123. How to remove that?
- How do you create a “virtual” page in WordPress
- Multiple endpoints to same page
- How to make a category page the blog home page?
- Preserving $_GET parameter while using custom Rewrite Rule
- Handle category name URL rewrite before different post type slugs
- Getting add_rewrite_rule and add_rewrite_tag to work
- Why did installing wordpress in url root jack up underlying WP sites?
- Creating a custom category page with pagination
- Passing & Reading URL Parameters with URL re-writing
- How Can I Have A URL Changed Based on the Originating URL?
- Custom Page Template for “Older Posts” Pages
- Prevent WordPress from automatically correcting URLs
- Display content according to current URL
- External/non-WP rewrite rule without QSA
- How to do Basic URL Rewrite Without Redirecting
- URL Rewrite doesn’t work for nested pages
- changing comment-page-# to something like review-page-#
- How does WordPress determine if a paged query var is too high?
- How to redirect http://mydomain/blog/blahblah/ to http://mydomain/blahblah/ in wordpress htaccess?
- Append a query string to the end of every URL
- Url Rewriting a dynamic wordpress page
- subdirectory install breaking existing links
- Right url for custom post type
- Preserve old website URL structure after migrating to WordPress
- Rewriting “pretty” blog category URL with htaccess / add_rewrite_rule() causes 404 page
- Taxonomy Pagination Rewrite
- Redirecting /px/?q=x to /px/x/
- Multiple query vars sorting combination and url rewrite
- URL redirect on updating the post date
- WP Rewrite issue
- WordPress keeps writing rewrite rules to .htaccess
- Is it possible to match site root with a WP rewrite rule? [closed]
- Insert post ID into the end of a slug preceeded by a dash
- Make Author Archive Page URL be a Subdirectory of a Custom Post Type URL
- Redirect old query string urls to new SEO urls
- Bilingual WP site: How to achieve different URL sturcture rule based on its language?
- Using a Rewrite URL in a Plugin to Load a New Page in the Template
- Overwrite WordPress’s URL rewrite not working
- Pagination problem (plugin wp-pagenavi) with a custom post type?
- Exclude subfolder in WordPress permalink
- wordpress path generation from rewrite rule
- How to add dot(“.”) in post slug
- How to implement pagination in category.php template
- Rewrite rule for custom permalink structure
- Help with .htaccess setup to hide WordPress Directory
- Ugly URLs when there’s pagination
- Unable to access the query variables in the template
- Hide wordpress source code
- Custom rewrite from URL to URL using slug
- Properly maintaining an old rewrite structure
- Add dynamic url with external page in WordPress
- Using 2 URL’s for WordPress
- Rewriting WordPress URLs
- How to change pagination base from slash to query form?
- How can i maintain permalink structure and avoid a 404 error when loading external content?
- How to rename the WordPress wp-login.php running on IIS6?
- get parameter from url rewrite [closed]
- Rewrite rule to simulate page hierarchy results in 404
- add_rewrite_rule not working with custom variables