If your form is embedded in a shortcode or some other front end form, I would post to the permalink for the page. That’s more reliable than using action=”” in my experience. Then output something on that page to acknowledge the submission or show an error.
$global $post;
printf('<form method="post" action="%s">',get_permalink($post->ID));
or in for a form on the admin side:
printf('<form method="post" action="%s">',admin_url('admin.php?page=custom_form'));
Within admin_url, include the portion of the page url that comes after wp-admin/
Related Posts:
- Plugin Form Submission Best Practice
- PHP error with shortcode handler from a class
- $_POST form request with admin-post
- Using a plugin class inside a template
- Handling results from data hooked into admin_post
- How to create a flexible abstraction for WP_Query?
- What is the real intention for admin-post.php?
- What is the correct way to build a widget using OOP
- How to make method from plugin available in theme?
- What is the recommended way to create plugin administration forms?
- Using OOP plugin’s methods throughout the website
- Single Responsibility Principle and WP Classes
- How Can I Add a Filter to Class Instance Only?
- The ideal place for storing persistent PHP objects
- Using AJAX in a plugin to submit form – REALLY confused
- Plugin Architecture/Design Pattern – is better to use a private Observer/Mediator Pattern for plugin subclasses or WP add_action?
- Post from front-end with post types, categories and taxonomies
- Front-End Form Submission in Shortcode
- Check spam in custom form – akismet
- Use a PHP file as action for a form in a WordPress plugin, what’s the correct way?
- Using a front controller in a WordPress plugin, any suggestions?
- Front-End Interfaces Without Shortcodes
- set_sale_price in WooCommerce [closed]
- Best Practices for Creating and Handling Forms with Plugins?
- Plugin options page – form with two different submit buttons
- WordPress Ajax callback function from plugin – OOP
- How do you render_callback for register_block_type to a method in another class?
- How to sanitize user input?
- How to Create database table when Plugin installed/activated, and delete database when Plugin deleted
- Registering and using actions which return results in a Plugin class
- Advice on plugin structure
- Applying OO patterns and principles to plugin development
- Creating a shortcode, but getting tied up with OOP and Classes?
- WooCommerce registration password field not displaying
- wordpress plugin php file processing form
- How to add custom fields to the all users page
- Error on inserting a form value to database
- Multiple options pages validation for a plugin
- Plugin Architecture Question: How to avoid using transients
- Form doesnt save to database
- What is the proper method of using global $post?
- Create custom HTML/JS app inside page
- Plugin Development for registered users
- Is there documentation reference for forms in menu and setting pages?
- Input in plugin widget does not allow spaces
- Dynamically creating classes for Widget API
- Avoid updating post when sending POST or GET request to post.php
- WordPress class, using add_action to call member function does not work
- admin_post equivalent for guest user?
- How can I add a simple custom field to my plugin?
- Remove an action by extending class and replacing it
- Using OOP inside a Plugin – Is it allowed?
- Run JavaScript validation script on form submit in plugin
- A question about add_action()
- WordPress plugin development OOP style
- I am unable to save my data from a form
- The Correct Way to Use Nonce Field without Settings API
- How to add search form in main page body?
- How to make and save custom form in custom plugin page?
- Catching Form Submission in WordPress Admin Panel
- Form using admin-post.php gives 404 after submission
- OOP plugin not working
- Submit form to a different PHP file in the same plugin folder
- A function that will remove HTML and tags from a string?
- Plugin Form Submitting to admin-ajax.php instead of admin-post.php
- Form submission to another page returning 404 error [duplicate]
- Lead form that submits to 2 external APIs
- WordPress: redirecting to the form page after form submission to admin-post.php
- 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
- Information and Page from WordPress Plugin
- Bad request 400 using class based files
- Why is that only the first row getting inserted into Mysql table when i import csv file on backend custom plugin?
- functions won’t fire after I converted my code from procedural code to OOP
- Using AJAX to submit and return data inside the WordPress Plugin Boiler Plate framework
- Performing ajax request in wordpress
- Error when activating a custom plugin on production server
- OOP development and hooks
- How to set a public variable in someone else’s plugin class
- Use admin-post to submit form data to external database
- How is construct function working even when variable is assigned null value?
- How to retrieve custom profile fields associated with different users
- form does not generate $_POST request
- Acessing WP functions in form submission handler
- Object Oriented plugin, add action and variables
- Form and database, plugin development
- Can I use a hook other than ‘init’ to handle form submissions?
- wp_mail links are dead
- 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
- Multi-part form and wp_redirect()
- How do I create Widget within plugin that uses its own class?
- Page reload occurs before request finishes
- Submitting a plugin form to database in admin page
- How To Remove The Filter That Adds JetPack Related Content To Dom [closed]
- Method not receiving attributes from shortcode call, general OOP problems
- Hook a search form anywhere on the site, using a custom plugin
- Plugin forms overwrite each other’s options
- Ethics question: what qualifies as a fork? [closed]