You’re close, the query var for passing page slug is pagename
:
add_filter('query_vars', 'add_account_edit_var', 0, 1);
function add_account_edit_var($vars){
$vars[] = 'account-edit';
return $vars;
}
add_action( 'init', 'add_account_edit_rule' );
function add_account_edit_rule() {
add_rewrite_rule(
'^my-account/([^/]*)/?',
'index.php?pagename=my-account&account-edit',
'top'
);
}
To capture the value in your rule, you need to pass the value in $matches[1]
:
add_rewrite_rule(
'^my-account/([^/]*)/?',
'index.php?pagename=my-account&account-edit=$matches[1]',
'top'
);
Related Posts:
- Redirect to another page using contact form 7? [closed]
- Change settings of get_post_type_object
- Rewrite/Change custom taxonomy slug
- Display Plugin information on specific url
- WP Job Manger change jobs url (NOT slug)
- Custom pages with plugin
- How can I find plugins’ slug?
- Preserve custom URL parameter on more pages
- Add rewrite rule to permalink structure
- Rewrite rule page url with category
- Add Rewrite Rule for custom page
- Installing plugins and using complex folder structure with child theme in WordPress
- URL parameters causing 404 on home page, but nowhere else
- change content based on url per plugin
- How to Create a Custom Slug for Tags and Categories with a prefix or suffix?
- Remove .htaccess portion upon plugin deactivation?
- Get plugin download URL from slug
- Removing Automatic Redirects Without Plugin
- Custom url rewriting
- rewrite_rules() not applying rules on plugin activation only after permalinks menu is clicked
- correctness of URL
- $pages = get_pages(‘child_of=’.$post->ID); Why arguments are concatenated?
- URL rewrite with external JSON query
- How do I convert my WordPress website to be domain agnostic?
- Need to change link URL embedded in multiple posts to new link URL
- How to pass a query string to another page on the same site?
- how to replace hostnames on certain external links?
- WordPress rewrite rules not working
- How to rewrite URL and get the values?
- Scrape a webpage for image and add it to post
- Do rewrites added with add_rewrite_rule() persist after plugin deletion?
- Change url of posts with keywords
- How to access the WordPress DB from a plugin file
- Passing value as hidden parameter to next page
- Replace video url with video player
- i want to rewrite my custom plugin url
- Offer Download Links for Product Images
- can’t install any wp plugins [duplicate]
- How to hide particular plain text with link from different subscribers
- Redirect unloggedin users
- Remove custom taxonomy name from the slug – Custom Post Type UI
- Change language on website and change currency with url query
- add_rewrite_rule to load different page, without changing URL in browser
- Add a parameter at the end of the url and prettify
- insert og image link in wordpress post
- How to create a folder in wordpress that will contain pages?
- How to generate expiring URL of the page?
- WordPress rewrite rule depend on meta values not ids
- how to include my homepage and scc in to a plugin
- Add custom WordPress admin page with pretty url via code
- How to allow URL with filename & extension in wordpress?
- How to define the slug for my custom plugin?
- Having multiple URL structure for wordpress blog
- Some resources of my website are pointing to www.mysite.com/dev/ and trying to get rid of that append has been a headache
- Change custom rewrite rule when permalink is updated/changed
- How do you remove question mark in URL in get method?
- plugin: rewrite rules are lost when WP updates
- WordPress drop domain alias
- URL Case Sensitivity (Unbounce Landing Pages)
- Convert slugs on post publish
- How to create multi-slug admin page and retrieve it with $_GET or something?
- Automatic set a featured image from the first image’s url (or tag) in the article
- WordPress website giving 404
- Infinite 301 redirects after definitions in “Redirections” plugin?
- Keeping original URL
- How to link file or image from wordpress plugin dir to theme by using themes function.php, is it possible?
- How to regenerate slugs for categories and tag converting non-Latin characters?
- Creating plugin for changing slug
- Custom pages with plugin
- add_external_rule – rules deleted when visiting permalinks page
- How to disable wordpress page rewrite rule?
- Using permalinks with parameters
- Images not showing on homepage after migration [duplicate]
- Creating custom URL for async content
- URL RewriteRule doesn’t work when using WP Database Participants in my WordPress website
- Rewrite URL to plugin file
- How to programatically create a simple HTML page using the permalink of a WordPress post?
- How To Rewrite WordPress Pages URL Only?
- Apache rewrite rules and wordpress problem
- How to get the parameters on page and avoid 404?
- How to create custom content on custom page from plugin?
- How can I process all requests for a given directory in a URL with my plugin?
- Unwanted Links and Spam WordPress Pages and Posts
- Why links are not linked if edited comment?
- Rewrite rule help for gallery plugin
- How to get the real address from a url (permalink)
- Remove base from the custom post type URL [duplicate]
- map urls to plugins
- HTML link within my plugin settings page
- Why plugin’s icon for the menu not found?
- Fetching Video From YouTube Automatically [closed]
- URL Redirect on GoDaddy platform [closed]
- How to create a custom wordpress plugin for a specific functionality?
- How to change all the urls of the WordPress site?
- How to Handle? vp_page Parameter in WordPress and Resolve Google Search Console Validation Issues?
- Trying to Find the PHP File/Function that Handles a Specific Form Action URL
- Help with coding a link for a button in WordPress with The Events Calendar Plugin
- Changing slug when post is copied
- How to Change Default RSS Feed URL in WordPress Website?
- Capture query param and insert into to form field