You just need to change the second parameter for get_edit_post_link()
, which is $context
and defaults to display
. And that parameter determines how to output the ampersand character (i.e. &
), which defaults to being encoded as &
(because the default context is that the URL is being displayed, hence the &
is encoded).
-
When using the URL with redirection, you would want to use the
edit
(or anything other thandisplay
) context:$edit_post_link = get_edit_post_link( $order_id, 'edit' ); wp_redirect( $edit_post_link );
-
When displaying the URL, you would use the
display
context:$edit_post_link = get_edit_post_link( $order_id, 'display' ); // Or you can simply ignore the second parameter: $edit_post_link = get_edit_post_link( $order_id ); var_dump( $edit_post_link ); // & becomes &
Related Posts:
- wp_redirect not working after submitting form
- Where does wp_redirect need to be placed to make it work?
- How to 301 private posts rather than 404?
- Redirect on successful login
- Need help to repair a 301 redirect problem
- Passing User Messages to Another Page
- How to disable redirect on test/staging copy of wordpress site
- wp_redirect not working when going to www version of site
- Cannot get redirect working
- Custom pagination structure
- wp_redirect “headers already sent” after front-end submission form
- Controller functionality – if user is not logged in send them to specific page (not wp_login)
- wp-admin Redirects to Docker Container Name
- Redirect to Referring URL after Login
- Why “exit” is needed after wp_redirect?
- wp_redirect not working in header, exit is breaking page
- how to block direct access to multiple thank you pages?
- Redirecting Subscriber Users to the home page after updating their profile
- wp_redirect not working from shortcode function
- Problem with is_page & wp_redirect
- Why is the session clearing after wp_safe_redirect?
- How to fix Ahref error showing wordpress admin pages as “Duplicate pages without canonical”?
- Problem in redirect link in wordpress
- Fix a Permalink plugin: it miss the redirect from old to new permalink
- Redirect Non-Logged In Users to Specific Page based on Page Template
- How to redirect non-logged in users from a URL to a specific page?
- Proper way to set author pages at root?
- How to Manually Upload Files via FTP
- Redirect to specific page
- blog url redirecting
- How to do 302 redirects “in” WordPress using Redirection plugin? [closed]
- wp_redirect giving a warning: Cannot modify header information – custom plugin
- Can I trust user input in wp_redirect()?
- force login and redirect to custom login page
- WordPress wp_redirect() not working after get_header();
- Redirect specific link for logged in users only to specific URL
- Redirection problems
- Use wp_redirect without filter in plugin file
- Redirect to Page URL for non-members
- How to redirect to cart page using wp_redirect [closed]
- WP Redirect is not working
- Redirect regex misbehaving when placeholder empty
- Redirect to first child in menu
- Why does user not logged in when using wp_signon function
- Website URL not getting updated
- wp_redirect and get variables
- Force Rewrite Query Var On Hierarchical (Nested) Page
- Strange redirect behavior after moving development site to client server
- how to use wp_redirect inside a function
- wp_redirect hangs, but returns true
- How we redirect to other pages in WordPress?
- Question about proper use of wp_redirect?
- Checking if a user is logged in, if so redirect to a different page
- How do you maintain a debug session after wp_redirect()?
- Infinite redirect loop in my local environment
- Why sometimes wp_redirect() reset cookie?
- wp_redirect is not working sometimes
- Staging redirecting to live site (under construction page)
- Redirect Users who aren’t logged in, aren’t post authors and aren’t admin. Frontend
- Looking to redirect a link
- How Do I Redirect a WordPress Website?
- Overiding wp_sanitize_redirect for | character
- changing products urls – redirects
- How to redirect single post to parent category
- Fix WP Redirect Loop
- Redirect CPT to child?
- Add action “page_template” not work with home page
- Does wp_redirect keep the referrer?
- wp_redirect only works for external pages
- wp_redirect shows header already sent message
- Too may redirects when i use the wp_redirect() function
- Redirect missing pagination to base page
- gravity form login widget redirect
- How is WordPress redirecting/rewriting my URL?
- Is this consindered safe redirect?
- subpages are redirecting to the homepage
- Does wp_safe_redirect() no longer works?
- Cannot find redirect – WordPress behind HTTPS proxy (Cloudfront)
- template_redirect to accompany with a shortcode
- Redirect to login page
- Redirect a list of URLs to another URL, using functions.php
- Code to create a redirection after login?
- Redirect to a welcome page after updating plugin
- How to use Regex to add to a url?
- WordPress redirects non-existing url to existing ones – how to disable
- Can I change default registration link (without htaccess)?
- Get query parameters from external url and make a redirection
- How to wp_redirect on ‘init’ hook on condition of current post id?
- Show different page for first time user
- Why does the $_GET parameter ?search forward the front-page to the archive/blog page
- How to redirect to home page according to a specific page custom fields value and user name
- How do I redirect a permalink for a Draft post to a custom 404 page?
- This webpage has a redirect loop issue
- Redirect Page ID, based on logged-in User Role
- remove SLASH on single_post but KEEP on categories and parent pages
- Redirect Function Prevents Images from Showing in Front-end Media Uploader
- Make custom post type archive for administrator only
- How to 301 redirect sub domain post URL to root domain
- How to redirect new registrars to a custom registration page instead of WP default registration page?
- redirect to a custom page