look for the string page/
and capture just the part of the url before it with strpos
and substr
:
$url="/players/type/pros/page/3/";
$find = 'page/';
$trimmed_url = substr( $url, 0, strpos($url, $find) );
EDIT – so in the context of your question you could use:
$url = $_SERVER['REQUEST_URI'];
$find = 'page/';
$pos = strpos($url, $find);
if($pos):
$url = substr($url, 0, $pos);
endif;
if( $url == '/players/type/pros/' ){
//run the query to list the pros
}
But a question I have – why are you using the URL to determine what to load, can you not check $_GET[‘type’] or whatever query vars are being set?
Related Posts:
- Pagination on custom post type not working
- Pagination when using wp_query?
- Find out total number of pages in global query on archive page?
- Post_count only shows the number of results per page
- WordPress Pagination Not Working – Always Showing First Pages Content
- get_query_var function not working at all
- get_query_var( ‘paged’ ) not working outside of homepage
- Pagination returns 404 after page 20
- Combining two wordpress queries with pagination is not working
- How to stop wordpress to make the default query?
- next_posts_link not working for loop called with ajax
- Query two taxonomies via URL or link?
- Why does pagination always break when used on any form of a home page?
- Pagination shows 404 after a certain number of pages
- Multiple endpoints in one URL
- 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
- Query with pre_get_posts to get pagination
- Pagination is not working using WP_Query
- Transient pagination not working properly
- Can not switch the queried post in pre_get_posts hook
- 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
- Pagination doesn’t work in custom page template [duplicate]
- Intentionally exceed max_num_pages on main query without getting 404?
- Get rewrite result
- WP_QUERY loop, offset in the arguments and the paginate_links – can these work together?
- 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?
- The pagination on index.php doesn’t work on a first page
- Get pagination working for custom loops within page templates
- Serve specific “template” page at any URL that ends in its slug
- pagination with ‘no_found_rows’ => true,
- How to figure out redirection and contents in hybrid solution containing word press content and legacy code (ASP.net)
- how to handle multiple ajax wordpress queries?
- WordPress pagination not working using WP_Query
- posts_per_page not working for first page of pagination
- Pretty urls for custom pagination
- Custom post type archive pagination query issue
- 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
- new WP_Query messes up pagination
- Pagination works in custom query loop but it doesn’t work in shortcode
- “paged” in WP_Query returns 0 posts
- If have posts a week old, display, else display a different loop
- 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
- Adding pagination to sub-wp_query within a singular post page
- Pagination problem by using WP_Query
- Ajax (jquery) wp_query pagination returns -1
- WP_Query and pagination AGAIN?
- Function the_posts_pagination() not compatible with WP_Query arguments
- adding pagination to a foreach loop in wordpress
- Pagination of custom page with custom fields query
- Custom wp_query inside a conditional stament inside a template part doesn’t work: why?
- pre_get_posts pagination not working
- Pagination not working on archive.php template?
- Pagination inside the blog page not working
- Pagination on archive.php not working?
- Custom Query Pagination not working on static front page
- WordPress search page pagination displaying but not functional
- pagination functions are not working
- Paginated Post List on Front Page
- Problem with custom WP_Query and underlying pagination/posts_per_page
- Rewrite rule pagination on different url levels
- 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
- Archive – Show Page Month Headers
- Query post Pagination Problem
- Pagination for custom query throws 404 errors on last pages [duplicate]
- Pagination is not working on custom query inside a custom home page template
- Pagination not working in some author pages
- How to add archives (with pagination) to page template?
- No content found on page 2 of pagination with 1 post per page
- Ordering Custom WP_Query loop by meta key value with pagination
- Loop being strainge
- Pagination in custom query not working [duplicate]
- paginate_links() on page (shortcode output)
- Multiple loops on index page with sticky post and pagination
- 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 showing same posts despite changing page
- 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