Your rule needs a little tweak. You also need to add id
to valid query vars.
function wpd_test_rule() {
add_rewrite_tag( '%id%', '([0-9]+)' );
add_rewrite_rule(
'^product/([0-9]+)/([^/]+)/?$',
'index.php?page_id=5&id=$matches[1]',
'top'
);
}
add_action( 'init', 'wpd_test_rule' );
Note that WordPress doesn’t put query vars in $_GET
, you’ll need to adjust your code to use get_query_var('id')
to fetch the value. I’d also consider using something more unique than id
.
Related Posts:
- How to add nofollow on all external links without plugin?
- AddToAny shortcode in the loop
- flush_rewrite_rules() not working with update_option_{$option}
- Plugin for TinyMCE to create reference to other posts
- Do shortcodes affect page indexing by search engines?
- Seo Problems in My meta Discription [closed]
- How to fix wrong attribute error for Visual Composer Grid Builder?
- ‘No Results Found’ on single post for custom post type
- Outbound link autometic converted into linkdirect , and not opening
- Making a Template for a CPT created by a plugin
- creating html reusable blocks via shortcodes
- Yoast SEO plugin “could detect no serious SEO problems” on dashboard
- Is it possible to use multiple post_name, post_title and post_content?
- add_shortcode is not working in plugin where others are working
- Single API call exposed via shortcode with params
- WordPress Sitemap including pages that aren’t there
- Modifying Author Link to add Author Meta in URL
- Change permalinks of custom post type ‘question’ as post id or any random number once
- Shortcode Plugin to dynamically build a shortcode via `do_shortcode` not working
- install robots.txt to wordpress website admin
- Remove /product/ from url. I want only category name then product name
- Making sure that a plugin’s scripts and stylesheets are included for dynamicaly loaded content
- Nested shortcode functions accessing variable
- Calling an attribute from a plugin shortcode
- Redirecting thousands of posts that currently have no category in their permalink when changing permalink structure to include category
- Best place for short bio,image and button [closed]
- Insert content of a post into another
- Customize permalink wordpress category id
- Reoccurring 404 Errors on all subpages
- accessing wp.media api from a tinymce plugin
- Creating shortcodes in plugin
- Visual Composer shortcode for child theme dir
- get_post_title is not working on homepage
- Some code in shortcode function being ignored
- Permalinks stopped working after migration with WP all-in-one migration plugin
- How to remove custom post type and add category and post name
- How to create a custom shortcode based on the layout?
- Perform internal redirect in WordPress?
- Using arbitrary paths in page urls
- “Custom Post Type Permalinks” plugin URL strcuture
- Filtering get_permalink in Jetpack / ShareDaddy
- Unable to add TAB character to post?
- Custom Permalink Plugin and Current Page/Ancestor in Menus
- plugin links not working [closed]
- plugin shortcode output
- Plugin generated taxonomies’ permalinks with custom placeholders
- How to Create a shortcode to this php function
- Inject HTML meta tag inside wordpress tag using add_shortcode
- How do I apply style to each category of a list?
- Create shortcode to echo javascript
- Check if SEO plugin installed
- Redirect to another page using contact form 7? [closed]
- What is @Action in WordPress?
- How to get the permanent link in a plugin?
- Custom Shortcode Broken in WordPress 3.1
- Use $_GET inside a shortcode print empty Array
- Namespaced shortcode?
- Where are theme codes located for WordPress?
- Show Sitename on Yoast SEO Title tag [closed]
- My plugin won’t return anything [closed]
- Help in using SEO Plugins: SEO Ultimate And Yoast SEO Plugin
- Anyway to convert a plugin to become a shortcode?
- Render Modula Plugin Shortcode On Ajax Request
- Shortcode to update user meta
- Yoast SEO settings unavailable in an archive page from wordpress plugin
- Why shortcode always displayed after footer not in body
- How to have sample page for each new register users in a membership website
- How can I run a custom shortcode function on a live site and only run if the viewer is a specific machine?
- using do_shortcode
- Why am I unable to load scripts in head in plugin?
- How to add a dvi tag to a shortcode then change a generated text using jQuery
- Deactivate JS Script in Plugin Shortcode
- plugin shortcode not working on ajax request call
- Displayed content disappears when adding attributes to shortcode
- Modify page title and subtitle with a plugin
- How do I pass custom shortcode-extracted variables (taxonomy) into a query function for WordPress RoyalSlider?
- Where to find the code used to render a page that has a shortcode and a template defined?
- Shortcode not working after move wordpress website files
- Shortcode not getting replaced
- How to activate a plugin on the activation of a theme?
- Add Shortcode tag in Widget/Sidebar
- Flipping Book PHP Code? Any experience?
- how to connect the author profile with google webmaster tools in multiuser blog?
- This WordPress plugin isn’t creating links correctly
- WPTouch – how to remove shortcodes or make shortcodes function
- convert more tag to shortcode
- Yoast Force Rewrite Crashed Site [closed]
- Shortcode does not expand in Facebook like
- rewrite_rules() not applying rules on plugin activation only after permalinks menu is clicked
- Is changing post from category in a large blog a good practice?
- XML Sitemap Generator can’t notify google and bing
- Plugin that provides the [edit] shortcode?
- Why is Google Search Console getting X-Robots-Tag noindex?
- Custom shortcode for displaying user based on a role parameter
- WordPress Plugin Insert Html Code with Shortcode
- How to remove index meta tag
- Return multiple values in a shortcode attribute
- IF condition based on wp_remote_get output
- shortcode not return any thing in Gutnburg
- Shortcode Attributes to Return different $_POST