Not sure of the context for this, is it a custom post type or just a page?
This might be something which you’re looking for –
function add_lead_management_endpoints() {
add_rewrite_rule(
'manage-lead/lead_id/([0-9]{1,})/product_id/([0-9]{1,})',
'index.php?pagename=manage-lead&lead_id=$matches[1]&product_id=$matches[2]',
'top'
);
add_rewrite_tag( '%lead_id%', '([^&]+)' );
add_rewrite_tag( '%product_id%', '([^&]+)' );
}
add_action( 'init', 'add_lead_management_endpoints' );
You’ll need to flush permalinks for this to take affect (visit settings->permalinks).
Related Posts:
- How to stop wordpress to make the default query?
- Query two taxonomies via URL or link?
- Can not switch the queried post in pre_get_posts hook
- Is there a PHP function that can match anything after the given URL, so my IF statement will work in each instance?
- Get rewrite result
- Difficulty with rewrite rules
- remove query arg from url after set query
- WordPress add_rewrite_rule() cannot visit lower url levels
- Serve specific “template” page at any URL that ends in its slug
- How to figure out redirection and contents in hybrid solution containing word press content and legacy code (ASP.net)
- How to use if($wp_query->query_vars[‘name’] == ‘pagethatdontexist’) without getting a 404? How to suppress 404
- JSON – Create rest api endpoint for Advanced Custom Fields
- WordPress rewrite with custom parameter doesn’t work
- How to allow a variable with “/” in wordpress url
- How can I re-query post_type and rewrite the url?
- Rewrite rule pagination on different url levels
- How to list posts of a given format
- Pagination on custom post type not working
- order by numeric value for meta value
- numberposts? showposts? posts_per_page?
- $GLOBALS[‘wp_the_query’] vs global $wp_query
- Some doubts about how the main query and the custom query works in this custom theme?
- Using the Rewrite API to Construct a RESTful URL
- Set Alias for meta_query arguments in get_posts()
- How can I use order_by to order by two meta_keys without excluding posts that don’t have those keys initialized?
- Loop within a loop?
- How to query only for products with status “in stock” in WooCommerce? [closed]
- Does WordPress sanitize arguments to WP_Query?
- How to get posts in different language from WPML Plugin [closed]
- WP_Query meta_query where meta value ends in space
- Meta Query querrying several post types based on ACF fields is broken after update to WP 4.1
- Hide posts from users with a specific role
- Show single post then all posts (with pagination)
- Show most popular post of last 12 months
- WP_Query to get posts in a specific category and post format
- Refine/Filter WP_Query Posts with jQuery or Ajax
- Can’t get drafts with WP_Query using post_status parameter
- Get ONLY the count from wp_query without fetching posts
- Different string for specifed post type on posts listing at homepage
- Exclude admin from WP_Query Contributors
- Order by custom table and multiplication
- WP_Query ajax loader detect end of posts
- WP_Query posts by distance based on LAT & LNG in Database
- list pages using page.php and NOT page-{slug}.php
- Changing WP_Query params with url Query Var
- Moving the array pointer inside a WP_Query while loop
- From where is archive.php getting its posts?
- Help with WP_Query – Too many mySQL queries
- How can I make WP_Query get posts that have a tag but also have random other tags?
- Access WordPress query by index number outside the loop
- Pagination outside of loop
- Multisite – Global CPT – advices?
- Combine two queries into one to use in loop
- get data match with extra field value using wp_query for custom post
- WP_Query for a taxonomy with different taxonomy types
- Append URL query to next post link in custom query
- How to compare a date in custom field with today’s date in custom WP_Query?
- Meta Query doesn’t works as espected
- Executing query_posts after wp_insert_post
- Redirect Search to Form When No Product Results Are Found
- wp_query posts with custom fields number smaller than
- Related Posts Excluding Certain Categories
- Pagination for custom loop on custom page template is not displaying anything
- Unlimited Page Sitemap Link
- Writing less unnecessary code with WordPress
- Custom taxonomy in WP_Query not working
- Add category to my get_post query
- How to sort by most watched in X days/months
- How to use custom page for all posts with custom url, call another directory?
- Pagination repeating posts on search results
- WP_Query breaking the loop in a nested loop
- How to use wp query in my custom page without including header and footer in wordpress
- WP_Query, ACF field and array
- cron job for custom post type not working since WordPress 5
- WP_Query – multiple orderby with a rand field, doesn’t work
- What does $temp do?
- query not working for ordering by meta_key
- Insert wp_query after the_content with plugin (filter the_content won’t work)
- Is instantiating WP_Query not possible within an admin Ajax call?
- wp_query sorting – one specific meta_key value at last and then sort by create date
- Calling body_class and wp_nav_menu for a different post
- Category Archive not working for pages
- Using the same WP_Query for shop and widgets in WooCommerce shop
- Order posts by more than one variable (meta_key and publish date AND time)
- How can I get all the posts that are related with a specific taxonomy term?
- Showing Children of page by name
- WP_Query for liked posts is showing all posts if none are liked
- Custom query on custom table fails
- Get closest event where meta_key field is an array
- Can’t get the_content to show
- Custom shortcode not displaying categories and correct date
- Set right order for query that returns posts based on two custom fields
- Meta_query weird behaviour
- Manipulating a query
- Modify query after meta value
- Splitting query results, on the frontend, into separate sections based on meta value without multiple loops?
- How WP determines archive page vs single page?
- Sort wp_query of two post types using meta datefield for one and date for the other – possible?
- wp_query returns all posts even with post__in and posts_per_page
- Get related posts from tag otherwise from category (Ajax Load More plugin)