You have to hook an earlier action to check if the form was submitted. Something like:
function wpa_process_form(){
if( isset( $_POST['my_form_data'] ) ){
// process form and redirect
}
}
add_action( 'init', 'wpa_process_form' );
Related Posts:
- Multi-part form and wp_redirect()
- Form submission to another page returning 404 error [duplicate]
- Information and Page from WordPress Plugin
- Plugin Form Submission Best Practice
- Handling results from data hooked into admin_post
- Optimize shortcode callbacks
- What is the recommended way to create plugin administration forms?
- How would I create a plugin for my shortcodes?
- How to prevent newline from appearing in shortcode?
- Shortcode adding p and br tags
- Enqueue script only when shortcode is used, with WP Plugin Boilerplate
- Using a Theme inside a Plugin directory
- How do I make specific plugin functionality apply to different sites in a network?
- Using AJAX in a plugin to submit form – REALLY confused
- Shortcodes, output buffering, and WordPress functions
- Filter on the_content ignores shortcodes
- stray elements
- Pass javascript result to shortcode executer function
- Check spam in custom form – akismet
- Get returned variable from a function to add_shortcode function
- Use a PHP file as action for a form in a WordPress plugin, what’s the correct way?
- Why is my shortcode not working
- Can’t get JS code to work with shortcode
- Best Practices for Creating and Handling Forms with Plugins?
- Cannot modify header information – headers already sent by pluggable.php
- Plugin options page – form with two different submit buttons
- How to sanitize user input?
- Gutenberg Block showing invalid content on edit
- Storing product price data in the database
- What is the best way to embed an JS App in a WordPress Page?
- How to add custom fields to the all users page
- What is the proper way to include Bootstrap when executing a shortcode
- Auto gallery from folder contents
- Secure Pages Best Practice
- Adding option to Gallery shortcode
- Custom login doesn’t work properly
- wp_redirect on base wp-admin and login
- Wrap text around shortcode
- wp_nonce_field displaying twice
- How to handle shortcodes through plugin
- admin_post equivalent for guest user?
- Using a custom shortcode from within the template of a shortcode plugin
- When echoing my own shortcode, it keeps adding a 1 at the end of my blogpost
- Automating the process of shortcode generation in a plugin – how is it done?
- Create Widget or Enable Shortcodes in Sidebar
- The Correct Way to Use Nonce Field without Settings API
- How to add search form in main page body?
- Shortcode not appearing when used as post content in wp_insert_post() or possibly, shortcode not being registered at all
- How to make and save custom form in custom plugin page?
- WordPress shortcode returns the data before
- Catching Form Submission in WordPress Admin Panel
- How to create ShortCode
- How to redirect home page to another page after login for all user?
- add_filter img_caption_shortcode not implemented
- shortcode tags not working in do_shortcode
- Submit form to a different PHP file in the same plugin folder
- How to insert HTML/CSS/JS into my iframe plugin?
- Plugin Form Submitting to admin-ajax.php instead of admin-post.php
- Redirect returning users to a certain page?
- Passing values between enclosing and enclosed shortcodes
- post content and shortcode content displaying out of order
- Font size of HTML content
- WordPress: redirecting to the form page after form submission to admin-post.php
- Cannot output plugin twice with shortcode
- How to call a function from a shortcode function in an oop plugin
- How to create a custom post-new.php page for plugin , no wp menu
- WPGut – Updating failed and shortcode?
- Detect if requested page is PWA on server side
- How to write a custom shortcode name book?
- How can we stop showing short code in create or edit post section
- Why is that only the first row getting inserted into Mysql table when i import csv file on backend custom plugin?
- Shortcode content is not showing. Only the [shortcode-tag] is showing
- Using AJAX to submit and return data inside the WordPress Plugin Boiler Plate framework
- Including content into an add_shortcode() function
- Use admin-post to submit form data to external database
- Pass javascript result to shortcode executer function
- redirect_to how to make it simply work with get parameter or similar?
- Shortcode from a plugin not working
- How to retrieve custom profile fields associated with different users
- form does not generate $_POST request
- Which filter to use to pre-parse form elements, which are generated by plugin’s shortcode?
- Acessing WP functions in form submission handler
- Can I use a hook other than ‘init’ to handle form submissions?
- Is there a way to tell if a shorcode’s handler is being run before or after the content formatting filter?
- How to add conent (text) to Add New pages form of admin in WordPress
- wp_mail links are dead
- Do a summary based on sections in a post
- Children Shortcodes?
- Wrapping shortcodes in another shortcode
- Best way to handle a form post in plugin
- Tracing dashboard publish settings from input form in WordPress
- Post data in wp-admin to external database
- Cannot echo a JS variable to a jQuery plugin coming from wp_localize_script
- Create pages for authors
- Submitting a plugin form to database in admin page
- Developing a wordpress.com shortcode [closed]
- WordPress simple ‘Hello World’ plugin – problems
- Leveraging Core Functionality in Icon Upload Plugin [closed]
- Hook a search form anywhere on the site, using a custom plugin
- Plugin forms overwrite each other’s options