If you need to pass some data over the redirect, you can do that by adding parameters to the redirect url with add_query_arg()
. But other more elegant solutions might exist also.
Single parameter,
wp_redirect( add_query_arg( 'notice', 'success', get_site_url(null, '/redirect_to_two') ) );
exit;
or multiple parameters
wp_redirect( add_query_arg( array( 'notice' => 'success', 'foo' => 'bar' ), get_site_url(null, '/redirect_to_two') ) );
exit;
Then use $_GET
to grab the parameter(s),
if ( ! empty( $_GET['notice'] ) && 'success' == $_GET['notice'] ) {
// Do whatever.
}
If I’m not mistaken, I don’t think you need to worry about unsetting arrays as data doesn’t normally persist in WordPress. Once you do a redirect all the data in your $variables
are gone.
Related Posts:
- Redirection plugin – how to let the editor access the ‘redirection’ menu?
- SSL redirect loop using WordPress HTTPS Plugin
- Redirection Plugin: Redirect all URLs with a regular expression
- Autogenerate wordpress shortcodes using array?
- Building a scalable WordPress favouriting plugin – one serialised meta value array or many meta records
- flush_rewrite_rules not working on plugin deactivation, invalid URLs not showing 404
- Can Not Redirect from Plugin-Registered Admin Page
- How to fetch serialized data from wordpress options
- Detecting $_GET parameters from any page + Cookie
- How to send “Location” header on plugin form submit event?
- Custom url structure for custom template
- wordpress custom login successful redirect hook
- Can’t access my WP dashboard: fatal error? [closed]
- merging an array to an existing array using add_filter
- How to redirect Old Post URL to new Post and keep Old post Comments?
- What’s the _wp_desired_post_slug value for?
- Redirect all blog links from WordPress.com site to new domain
- WP Job Manager Category Drop-down; Change Placeholder Text Via Filter
- Pass a php string to a javascript variable
- how can I link to a PlugIn admin-sub-menu page after processing a formular
- How does automatic redirection for the redirection plugin work?
- Changed permalink structure. Need help with redirecting old posts
- WordPress Redirect Not Working – AJAX Callback Response Not Picked Up
- Landing Page Redirect Chain | http->https->https www
- How can I check if on specific plugin generated page or child
- Redirection based on location but without affecting search bots
- Page Restriction and Redirect for Particular Levels or user
- how to create site exit messages with destination url displayed
- How to redirect a URL with parameters?
- WordPress Shortcode to get URL Parameters $_GET[‘name’] redirects for no reason at all
- Redirecting a buddyboss profile tab to a different tab if not subscribed to a specific membership
- Redirect already logged in users away from a page to a specific page base on user role
- How to fix the woocommerce – adaranth.com redirection issue [closed]
- Redirecting thousands of posts that currently have no category in their permalink when changing permalink structure to include category
- Using Wishlist Member and I need to access a user’s status
- Redirect to another page using contact form 7? [closed]
- How to use login_redirect with a user capability
- Removing Automatic Redirects Without Plugin
- WordPress 4.3 broke meta redirect (with url params plugin)
- Edit Permalink Structure For Custom Post Type or Modify .htaccess?
- Mask and Track Outbound Links
- How can I redirect some pages to new subdomain? [closed]
- Any idea how to get something like this to work? [closed]
- What form should the $query media query array have for an Elementor page builder function? [closed]
- Integer in Array returns null
- Add key and value to an array in another file
- Adding option values as an array using a multi selectable select box
- Conditional custom redirect
- Making the ‘add to cart’ button redirect to PayPal
- PHP mobile redirect Endless loop
- How to force load a page in plugin?
- wp redirect 301 not working in wordpress page
- Preserve Search engine index while shifting to new Domain
- Janrain/Simple Modal under Redirected Domain
- Redirect unloggedin users
- login form should redirect to register page for in 1st login next time it should redirected to home page
- Identify User Language, Redirect to the corresponding page and Save the chosen language as Cookie
- www redirects to another directory in wordpress
- Hidden permalink different from displayed permalink
- redirect to homepage once action is completed
- Creating an array from form inputs before it is posted to the options database
- Display value of the GET parameter in a new URL page
- Redirect to a page while maintaining search query parameters without causing an infinite loop
- Adding an item to an anonymous array inside a filter?
- Can’t add new plugin or themes on a wordpress multisite network from the primary site as administrator. Error: ERR_TOO_MANY_REDIRECTS
- How to update all in-site redirect URLs to destination URLs at once
- How to send new visitor to a splash page for only one time in wordpress?
- WordPress Admin login redirect to homepage
- How to make this custom capability work? [duplicate]
- Why is my site still showing insecure icon even if I have SSL certificate?
- Reverse count page view and show on other page
- redirect to a custom page
- Plugin error “array_key_exists(): The first argument should be either a string or an integer” [closed]
- .htaccess file doesn’t work, with hundred tries
- Identify if the_post hook is being called from the admin post list
- Infinite 301 redirects after definitions in “Redirections” plugin?
- Clone a Post Tite and Custom Field into Custom Post type
- Direct URL to a template via plugin
- Need help getting a certain value out of a multi dimensional array
- How to redirect from plugin page
- Page doesn’t load
- Template redirect inside of plugin not redirecting
- Can’t redirect to previous page after using GET
- Pull Data from DB for Admin Page Display as Relates to Admin Page Class by BA Internet
- Need to change contact email depending where user is from
- Redirect url in plugin to somewhere else?
- Insert dynamic content into posts
- How do I to override login redirect on specific pages?
- How to link that “logged in” in “you must be logged in to post a comment” with custom login page on WordPress?
- Simple WordPress function / plugin to redirect a site
- Output dropdown results into Woocommerce Order details
- URL Redirect on GoDaddy platform [closed]
- Redirecting to page on form submit – Revue plugin
- how to make wordpress remember my choice
- Page with redirect
- Show a different number of posts per page depending on context (e.g., homepage, search, archive)
- Parse error: syntax error, unexpected ‘new’ (T_NEW) in /misc/41/000/204/381/9/user/web/ragami.net/wp-settings.php on line 219
- Plugin Options not being output
- How to have sample page for each new register users in a membership website
- How to edit a published post?