You’re trying to send a redirect header on the admin_menu
action, which is fired after some of the page has been sent to the browser. You have to hook an earlier action before output starts, like init
.
add_action( 'init', 'wpa_test' );
function wpa_test() {
if(isset($_POST['submit'])) {
wp_redirect( home_url() );
exit;
}
}
Related Posts:
- WordPress Redirect Not Working – AJAX Callback Response Not Picked Up
- How to redirect Old Post URL to new Post and keep Old post Comments?
- send_headers don’t work on wordpress multisite
- 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
- My single.php page does not show the related data to the post which is clicked
- Get ‘Headers already sent’ error for the plugin I am creating when I try to login
- Content-Security-Policy Headers are there and showing the correct settings, but still getting a refused connection
- Redirect unloggedin users
- Prevent WordPress from sending set-cookie http header
- Redirect to a page while maintaining search query parameters without causing an infinite loop
- How to send new visitor to a splash page for only one time in wordpress?
- Modifying server’s response to API endpoint
- Reverse count page view and show on other page
- redirect to a custom page
- .htaccess file doesn’t work, with hundred tries
- Disable email notification after change of password
- __(): What if I have to pass in a variable?
- How do I make my plugin load before the headers are output so I can redirect wordpress?
- Run WP-CLI using PHP
- How to remove duplicate sub-menu name for top level menu items in a plugin?
- Plugin update error message
- How can I make my custom shortcode work in a Custom HTML Widget?
- PHP Deprecated: Non-static method should not be called statically
- Set a User as Author of all ‘New Posts’ posted
- Calling function from within functions.php returns unwanted value
- Ajax call doesn’t work in frontend but it’s working in backend (when I’m logged in)
- White text on white background in TinyMCE when wp_editor is called in WP 3.9
- Is it possible to filter the wp_footer() scripts, read the content, and insert them inline?
- Loading class files via autoload method
- Adding a custom line of text to php code
- plugins_url() incorrectly returns a url with www subdomain
- Modifying Footnote Plugin for Descriptive Title Attributes
- I would like to use create a function in my custom plugin to tell WP to use a different header
- Getting media library popup in custom plugin admin page
- Escape when echoed
- add_meta_box (Will display only in specific page admin WordPress)
- How to write one comment and publish on every post using database or plugin?
- Make id column as AUTO INCREMENT on plugin activation
- Redirecting to home page after login as custom role WordPress
- Notepad sticky plugin
- WooCommerce Custom Product to checkout
- How to stop or remove an action being called inside a function of an extended class
- How to simultaneously access the same MySQL database in the main column and sidebar of WordPress?
- Date calculations from 2 custom fields
- How to debug error message: Cannot modify header information
- Easiest way to add dropdown to a page
- Assign / update custom field value for all posts (How can I assign only to posts without custom field value?)
- How to enable specific plugin only based around shop manager role?
- Adding a new field to the address field type in gravity forms
- Show admin notice on incorrect value on form field
- WordPress adding a menu page when activating a plugin
- What does making sure “that your theme is WordPress header and footer tag enabled” mean?
- Redirect to another page using contact form 7? [closed]
- Is wp-app.php or wp-apps.php needed for WordPress?
- Warning: Use of undefined constant list_all – assumed ‘list_all’ (this will throw an Error in a future version of PHP)
- How to distinguish if a plugin is not installed or just not active
- JavaScript in a PHP plugin
- Checking the count within a foreach loop
- Mask and Track Outbound Links
- Is there a function to list all uploaded images? How can I add one?
- How to use custom Javascript code inside a plugin?
- How to use printf to output two links?
- speed up pagination for huge database
- 2 wordpress site same database
- How to redirect to a page after the form is submitted
- How do i ‘deactivate’ a plugin only on a certain page template?
- WP Insert Post If user refreshes override new post
- Code for unique user visit count on every page WordPress
- Searching a tab/space delimited text file based upon form criteria and returning a ‘record’ into a word press results page
- How to makes changes on the shop/category/tag pages but not on the product pages in woocommerce?
- www redirects to another directory in wordpress
- Custom Plugin: How to Include Install Buttons of other 3rd Party Plugins?
- Getting Fatal error: Uncaught Error: Call to undefined function plugin_dir_path() when linking to another file within my wordpress plugin
- the content of the uploads folder gets deleted periodically, how to figure out what causes it?
- front end editor creation for Restropress plug in – displaying information from a WP admin area, on a different URL
- Custom Field used to allow a Free Story; no longer works
- How to change the width of certain paragraph or header blocks?
- Cron job shedules replace?
- Create a form and have custom menu display based on user answers?
- Can i add custom code in Source in specific page, Header from function.php?
- Problem with conditional woocommerce custom checkout field
- GET web api method from a WordPress PHP script
- Insert Plugin on a custom page
- Editing Global Variables from Inside Functions
- Posting code inside the post instead of in the template file using shortcode
- Can anyone tell me why I can’t edit a plugin when it is installed without having to re-install?
- conditional tags for the output of a plugin
- Can’t insert files in other inputs
- How do I output user_registered time in my correct timezone?
- How to tweak a plugin without preventing it from updating
- Place max_execution_time in plugin [closed]
- Creating a press page for our project
- how to search through plugin in wordpress cimy-user-extra-fields?
- wordpress illegal string offset ‘parameter’ error
- how to show selected options drop down menu values in attributes field in after saving post.php
- Make plugin admin page visible to other roles
- How Create LastMod and Update Date Only on Taxonomy Category and Tags
- Accessing Correct Database to Create REST API Endpoint
- How do I replace a logo image that’s hard-coded into a plugin’s logo.php file?