You need to add a query var and rewrite rule to make that work.
First, add the query var to WordPress query vars array in your theme’s functions.php
:
add_filter( 'query_vars', 'wpa58904_query_vars' );
function wpa58904_query_vars( $query_vars ){
$query_vars[] = 'my_page';
return $query_vars;
}
Then add a rewrite rule with your desired pattern that sets your custom page query var:
add_action( 'init', 'wpa58904_rewrites' );
function wpa58904_rewrites(){
add_rewrite_rule(
'places/([^/]+)/mypage/([0-9]+)/?$',
'index.php?venue=$matches[1]&my_page=$matches[2]',
'top'
);
}
Then in your template you can access the value of my_page
with
get_query_var( 'my_page' );
Be sure to visit your Permalinks Settings page after adding rewrite rules to flush the rewrites cache.
Related Posts:
- Pagination Not working on Home Page with 2 Query
- Cutom wp_query for geolocation search, pagination not working
- How to set up pagination for a custom loop on a global template (author.php, tag.php, archive.php?)
- Switched from query_posts to wp_query, pagination no longer working
- WP_Query breaks pagination
- Pagination problem with multiple loops on the same page
- Pagination when using wp_query?
- Post_count only shows the number of results per page
- Pagination on a WP_query not showing navigation links
- paginate_links ignore my format
- Combining two wordpress queries with pagination is not working
- How to paginate attachments in a secondary query as gallery?
- next_posts_link not working for loop called with ajax
- Why does pagination always break when used on any form of a home page?
- Pagination shows 404 after a certain number of pages
- Pagination not working for Custom search form & custom result template
- How to adjust found_posts so that it accounts for offset and pagination
- Pagination broken when merging search results with additional WP_Query
- Pagination causes error 404 when used with front-page.php
- Paginated pages are showing correct content but pagination links are not
- Query with pre_get_posts to get pagination
- Multiple keyword search
- Pagination is not working using WP_Query
- Show default content if custom WP_Query has no posts
- Is there a PHP function that can match anything after the given URL, so my IF statement will work in each instance?
- Add custom search results to main WP search [duplicate]
- How to bring specific post to front of wordpress loop?
- Pagination for custom query on single.php
- Intentionally exceed max_num_pages on main query without getting 404?
- Too many posts cause slow load when paginating
- How to output different posts per page?
- Multiple WP_Query loops with Pagination Not Working
- Posts loop with pagination on a single post page
- Custom pagination with WP_Query generating 404 error
- Offset Page Loops and Pagination
- Create A Loop With A Variable Number of Posts For Each Bootstrap Row?
- Is there any advantage of using default WordPress Search instead of creating a custom one?
- The pagination on index.php doesn’t work on a first page
- Get pagination working for custom loops within page templates
- Use post object from first query in second query
- pagination with ‘no_found_rows’ => true,
- how to handle multiple ajax wordpress queries?
- WordPress pagination not working using WP_Query
- Query to get siblings and parent page
- posts_per_page not working for first page of pagination
- Pretty urls for custom pagination
- Include data from custom table in WP_Query
- Custom post type archive pagination query issue
- echo a specific meta_key queried through a custom post
- WP Group posts by year(desc) > month(desc) > date(asc)
- paged variable not working for category/custom post archive
- WordPress Blog Posts with Pagination inside a Page/Post
- Pagination only won’t work in author template
- wp query error while paging the posts
- Pagination works in custom query loop but it doesn’t work in shortcode
- “paged” in WP_Query returns 0 posts
- Notice thrown when creating numeric pagination on custom query
- Content not displaying on paginated page
- Second loop pagination changes URL, not content
- Custom Homepage Pagination using WP_Query
- filter posts by meta key with pagination
- Pagination problem by using WP_Query
- Magazine style frontpage with multiple categories/loops and no duplicate posts
- WP_Query and pagination AGAIN?
- Where is this query?
- adding pagination to a foreach loop in wordpress
- Custom order revolution sliders post base slides as inserted in Specific Posts List field
- Pagination for Category does not work
- Display the search results like the original pages
- Pagination on archive.php not working?
- Woocomerce – Order products by float attribute in archive pages
- pagination functions are not working
- Problem with custom WP_Query and underlying pagination/posts_per_page
- Pagination in WP_Query?
- 2 Loops on one page – pagination of 2nd loop ignore array of excluded posts
- 3 wp_query on one page with pagination for last query
- Custom pagination (Title, date and teaser)
- custom query – offset to pagination
- Add pagination to table generated by wp_query
- Pagination is not working on custom query inside a custom home page template
- Pagination in custom query in a category page
- Pagination not working in some author pages
- Get the type of an advanced custom field (ACF) in a WP_Query loop [closed]
- How to add archives (with pagination) to page template?
- No content found on page 2 of pagination with 1 post per page
- What is wrong with this pagination code?
- Can’t get pagination to work with this WP_Query loop
- Pagination in custom loop [duplicate]
- Loop being strainge
- Pagination in WP query with transient API
- Multiple loops on index page with sticky post and pagination
- Pagination not working in secondary query
- WP Paginate not working properly
- Paginate wp_query while utilizing post__not_in
- Get next post when using pagination with WP_Query?
- Duplicate posts showing up in loop using infinite scroll
- Pagination with Custom Post Type not working on index.php: I get a 404
- Search results stuck on page 1
- Pagination only showed when no category is set in wp_query
- taxonomy-{term}.php terms pagination returning 404 after a certain page