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?
- Add rewrite rule to permalink structure
- Add Rewrite Rule for custom page
- add_rewrite_rule, plugin activation and plugin deactivation
- Using rewrite rule to access a view of a plugin from home page
- flush_rewrite_rules not working on plugin deactivation, invalid URLs not showing 404
- Prevent page slug from interfering with custom post type archive permalink?
- Custom rewrite rule is not picked by WordPress
- flush rewrite rules doesn’t flush them (still got 404)
- How to prefix `attachment` permalinks with `attachment`?
- Alter post slug by a filter that is fired just after a post is created
- Author Specific URL’s in WordPress
- While Using Static Pages, How Can I Get /blog into the URL of Each Post?
- Does flush_rewrite_rules() remove all rules added by other plugins as well as mine?
- Add_rewrite_rule doesn’t add custom url in plugin
- How to get Plugin Slugs?
- I need to generate the CSS for my plugin from a function, how do i map a request to a function in the front-end?
- How do I get slug of all active plugins programmatically?
- flush_rewrite_rules() not working on plugin activation
- What user roles should have wp_unique_post_slug_is_bad_flat_slug filter applied?
- How can I pass a variable to a page with a SEF url?
- locate_template with multiple categories?
- custom taxonomy and custom post type url conflict
- Rewrite url without flushing the database?
- Best way to hook a custom url?
- Remove rewrite rules generated by plugin during deactivation
- Changed permalink structure. Need help with redirecting old posts
- What is an arbitrary URL?
- How can I change a plugin’s URL?
- How to make a proper custom post type link
- Why WordPress plugin url ajax doesn’t work?
- Added slug after URL permalink last slash returns different content
- Custom rewrite rules not working with WPML
- Is it possible to use multiple post_name, post_title and post_content?
- WordPress shows error related to allow_url_fopen
- Ability to automatically redirect a URL
- Changing page URL and connect newsletter to MailChip
- Problem with Author page redirect
- Subdomains with almost the same content
- 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?
- 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
- URL rewrite with external JSON query
- Need to change link URL embedded in multiple posts to new link URL
- how to replace hostnames on certain external links?
- WordPress rewrite rules not working
- How to rewrite URL and get the values?
- Do rewrites added with add_rewrite_rule() persist after plugin deletion?
- How to access the WordPress DB from a plugin file
- Passing value as hidden parameter to next page
- Replace video url with video player
- Offer Download Links for Product Images
- How to hide particular plain text with link from different subscribers
- Remove custom taxonomy name from the slug – Custom Post Type UI
- 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 generate expiring URL of the page?
- 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?
- 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?
- Infinite 301 redirects after definitions in “Redirections” plugin?
- How to regenerate slugs for categories and tag converting non-Latin characters?
- Creating plugin for changing slug
- How to disable wordpress page rewrite rule?
- Using permalinks with parameters
- Creating custom URL for async content
- 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 can I process all requests for a given directory in a URL with my plugin?
- Why links are not linked if edited comment?
- Rewrite rule help for gallery plugin
- map urls to plugins
- Fetching Video From YouTube Automatically [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
- Changing slug when post is copied