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
- Pass user role to javascript code inside body
- Adding Plugin Assets to Header
- How can I redirect some pages to new subdomain? [closed]
- Integrating boxtal PHP library into a custom WordPress Plugin
- wp-mail attachment is not sent for no reason?
- syntax error, unexpected ‘while’ (t_while) please help :)
- How to redirect to same page after form submission
- Any idea how to get something like this to work? [closed]
- A server-side hook failed when committing plugin code to SVN
- Custom shortcode for displaying user based on a role parameter
- wp_dequeue_script for a Plugin
- Use $variable from file1.php in file2.php (different file paths)
- Need to replace Currency Shortforms
- wp_enqueue_scripts
- Return multiple values in a shortcode attribute
- get specific value of a array | PHP
- How do I add $_SESSION[”] to my wordpress page?
- How to get specific string/value from an array? php [closed]
- coding a WordPress AJAX Form using PHP to check if User is Logged Out and Show error
- Add User Role: Pre-saved in User-Meta [SOLVED]
- WordPress Console Application (ability to excecute a custom function via crontab only)
- How to make a dynamic css class whose name changes every visit to confuse scraper
- Plugin onclick button activate other plugin
- Show icons or badges under title on product archives/category pages
- Redeclare function after plugin activation
- get_edit_post_link() not working on wp-cron
- I receive taxonomy id
- WordPress Stock Update Programatically
- Woocommerce Backend Search by Title and SKU
- output html on post or page from custom plugin [closed]
- Is there a way to convert shortcodes to html content?
- UTF-32be error WordPress
- Loop in elementor custom widget not working
- Change text string in a plugin
- How to create plugin/ page that reads from database
- get_users(); Is an Undefined Function When Used in Cron Job
- the_content() printing DOCTYPE, and tags in the middle of page
- Control page content visibility based on URL parameter
- WooCommerce Shopping Cart Not Initially Showing Products [closed]
- How can I fetch data from another website to my wordpress website with mysql database
- Is this a correct usage of ob_start() in my WordPress project?
- echo get_option in header template
- Plugin not working & permalink erorr after upgrade to php 7x on Nginx
- How to add a new column with text fields to WooCommerce Cart List?
- Save user total active time after login in wordpress [closed]
- I am trying to make a field show and save from quickedit screen
- Add to array, redirect and display
- PHP if statement with German umlauts [closed]
- Send email with list of active plugins upon activation/deactivation
- Built a second plugin but it overwrote the first one
- Creating a functionality plugin to edit seriously simple podcasting
- How to include a custom field in the woocommerce email?
- Why does this code snippet create a critical error on my site? [closed]
- WordPress: Add custom add_filter for custom functions
- Programatically upload a file to be stored inside blob field in database, NOT on filesystem
- How WordPress core manage the plugin installation
- Shortcode not working – quotes seems strange
- Background Music WP [closed]
- Using custom fields for image alt and title
- Get all the URLs of the pages that uses a specific shortcode
- How can i add simple code in only in posts by function.php
- How to display registered customer list as dropdown in WooCommerce checkout?
- Hide DIV if empty – Plugin Gallery
- Error When Trying To Login [closed]
- How to change WooCommece variation data programmtically [closed]
- Getting a ressource ID, from a WC_Order_Item_Product/Order
- How to include files relative to a file’s directory
- How to redirect non www to www? [closed]
- .php file for woocommerce edit category? [closed]
- Customize Menu | Styling LESS/SCSS code formats
- Switch from wp-cron to a server cron job
- How to translate wordpress error message
- Asynchronous request in wordpress
- Override a Plugin Function
- Api external with wordpress
- All custom widgets are not showing in widget area at the same time
- How to delete all categories programatically?
- How to use custom Javascript code inside a plugin?
- Make plugin php file called directly aware of WordPress?
- How to use printf to output two links?
- Why is it important to check for isset and is_array before checking in_array in this example?
- Adding a simple Javascript file with a plugin
- WordPress custom post type image in RSS
- How to add/change (woocommerce) product tab icon