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
- Add Rewrite Rule for custom page
- add_rewrite_rule, plugin activation and plugin deactivation
- Which method is best to enqueue scripts
- Using rewrite rule to access a view of a plugin from home page
- 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
- Woocommerce different URL for every table placed in the restaurant
- Author Specific URL’s in WordPress
- 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
- Add query string to plugin URL
- 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?
- Is revealing just the AUTH_KEY a security issue?
- How do I get slug of all active plugins programmatically?
- flush_rewrite_rules() not working on plugin activation
- How can I pass a variable to a page with a SEF url?
- WordPress custom URL Rewrites redirecting not masking
- How to add rewrite rules and pagination to retrieve attachments files?
- custom taxonomy and custom post type url conflict
- What is an arbitrary 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?
- register_taxonomy and variable rewrite slug
- Is there a hook to Intercept al urls from a webpage and redirect to a page
- 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?
- Remove .htaccess portion upon plugin deactivation?
- Get plugin download URL from slug
- 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
- How to access the WordPress DB from a plugin file
- 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
- Change language on website and change currency with url query
- 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?
- plugin: rewrite rules are lost when WP updates
- Convert slugs on post publish
- Automatic set a featured image from the first image’s url (or tag) in the article
- Keeping original URL
- How to link file or image from wordpress plugin dir to theme by using themes function.php, is it possible?
- Creating plugin for changing slug
- Custom pages with plugin
- How to disable wordpress page rewrite rule?
- Using permalinks with parameters
- 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 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?
- Unwanted Links and Spam WordPress Pages and Posts
- Why links are not linked if edited comment?
- How to get the real address from a url (permalink)
- Remove base from the custom post type URL [duplicate]
- HTML link within my plugin settings page
- URL Redirect on GoDaddy platform [closed]