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
- PHP error with shortcode handler from a class
- $_POST form request with admin-post
- Add self-closing shortcode button to TinyMCE in WP 4.6
- Handling results from data hooked into admin_post
- What is the real intention for admin-post.php?
- 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
- Are shortcodes case-sensitive?
- Enqueue script only when shortcode is used, with WP Plugin Boilerplate
- shortcode executed in the page editor
- 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?
- How to make my shortcode load scripts and styles, from within the plugin?
- WordPress shortcode returns the data before
- How to display the categories on page using shortcode?
- Catching Form Submission in WordPress Admin Panel
- Redirect in WordPress plugin
- Shortcode conflicts
- Form using admin-post.php gives 404 after submission
- How to create ShortCode
- How to display the specific post content by using POST ID
- How to output functions from plugin inside theme
- 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
- A function that will remove HTML and tags from a string?
- How to insert HTML/CSS/JS into my iframe plugin?
- Plugin Form Submitting to admin-ajax.php instead of admin-post.php
- Including template in shortcodes
- Redirect returning users to a certain page?
- Passing values between enclosing and enclosed shortcodes
- Lead form that submits to 2 external APIs
- 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
- Paragraph Tags removed when contents are only a 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?
- By adding “?login – failed” code unable to access my dashboard
- How can I pass WP_Query results to a plugin?
- 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
- get_queried_object_id combined with wp_redirect gets wrong id
- 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?
- Some data has already been output, can’t send PDF file – fpdf issue in WordPress
- How to Maintain url on form submit
- How do I make two shortcode use the same id and increment it when I use them multiple times?
- 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?
- Caption Shortcode: what filter to change the image size?
- Acessing WP functions in form submission handler
- Form and database, plugin development
- 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
- Identifying a Page Containing Shortcode at `init`
- 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
- How to show custom taxonomy child posts through shortcode in WordPress
- add short code not working
- Create pages for authors
- Page reload occurs before request finishes
- Loop output for custom plugin [solution found]
- Submitting a plugin form to database in admin page
- Correct usage of scripts with shortcodes
- How to Pass ID through Short Code
- Shortcode attribute “title” doesn’t appear in $atts array
- Developing a wordpress.com shortcode [closed]
- WordPress simple ‘Hello World’ plugin – problems
- Shortcode rendered in preview, but empty in post
- How to display .ptm file in my WP site without JAVA
- Leveraging Core Functionality in Icon Upload Plugin [closed]
- Developing an IP lookup function using an API
- Hook a search form anywhere on the site, using a custom plugin
- Plugin forms overwrite each other’s options