There are two options to use forms in a dashboard widget:
-
Use the parameter
control_callback
. See the Codexwp_add_dashboard_widget( 'my_id', // $widget_id 'my_name', // $widget_name 'my_render_widget', // $callback 'my_control' // $control_callback ); function my_control() { // print some form elements, WordPress will handle the <form> tag. }
-
If you want to use a form in the main display handler, set the form action to
admin-post.php
and add a callback function for a customaction
there. Example. When you are done processing the form redirect back to the dashboard.
Related Posts:
- Created Widget Not Showing up on Admin Panel
- Conditionally enqueue a widget’s script/stylesheet in HEAD (only when present on page!)
- Plugin upgrading: Widget settings
- How can I make my custom shortcode work in a Custom HTML Widget?
- Delete Custom Dashboard Widgets
- Editor access to plugin settings
- How to pass JavaScript variable to PHP in wordpress widget?
- Is dynamic forms/entries possible in Widget?
- How do I add a widget programmatically to a newly created site (WPMU) within a plugin?
- WordPress widget / plugin….fields not appearing in my widget
- Remove Widgets in Dashboard
- How do I register a stylesheet inside a WordPress widget?
- Detect if a plugin was included in a certain page
- Dashboard Widget Form
- Passing $this->get_field_name() to javascript
- Ajax gives 400 error
- Determine Registered Admin Menus
- Archive – same title for the first two posts
- Ajax contact form widget plugin data not insert in database
- How to exclude certain files from the plugin editor?
- WordPress Widget – Saving multidimensional arrays into $instance
- Widget’s container?
- I changed font of wordpress dashboard but it is slow!
- strange shortcode error: does shortcodes requires any dependency?
- WordPress Widget Not Saving Instance
- How to set the default value as the saved value once a form of widget is saved?
- My widget won’t update its values when save is clicked
- How to add captcha to publish widget
- Table of contents (TOC) plugin is not showing header tag
- Widgets are not displaying in the admin panel
- Use localized plugin name and description even when the plugin is disabled
- How to access a wordpress plugin page or add posts without doing it from the WordPress dashboard?
- The styles in the recent posts widgets plugin not working
- Using foreach loop for `$instance` of form and update array widget iteration
- One time call to external API in widget
- Widget outputs the value but doesn’t save anything inside the textarea
- WordPress Widget: Is it possible to make the form dynamic without updating?
- Plugin Works, but Widget Doesn’t
- Widget Script Loads at Bottom of Page
- Widget redirecting to home page
- WordPress plugin not eching popular posts
- What are the downsides of using bootstrap in plugin development?
- What can I do to customize a widget provided with this plugin? from where have I to start?
- Display Any Field fromAdmin Panel in Frontend via Shortcode?
- is_plugin_active function doesn’t exist
- Where can I find a schema of wordpress plugin core architecture?
- How To Determine If A Filter Is Called In A Sidebar/Widget Context?
- WordPress network: set themes and plugins for new blog
- Admin-ajax.php is dying “0” without processing function
- How to remove an Ajax action
- Has anyone used require.js for handling plugin scripts?
- Multiple files in a plugin
- Escape when echoed
- How to remove the woocommerce_checkout_process action hook in woocommerce if particular project in cart [closed]
- WP_Query ordering numbers as letters
- WordPress Automatic Plugin Update Renames Plugin Directory
- HTML in WooCommerce settings
- Redirecting to home page after login as custom role WordPress
- Where (or when) should I register a new taxonomy?
- How to stop activating a plugin and show admin notice when dependent plugins minimum version is not met
- Fixing WordPress’s Bug (failed to send buffer of zlib output compression) results in “White Screen of Death”
- How can I make my metabox appear?
- Consolidate plugin functionality into a theme
- qTranslate remove default directory from link
- Setup page on first login on multisite
- Count posts by type including drafts and pending posts
- Redirect to another page using contact form 7? [closed]
- Separate database for a wordpress plugin
- WordPress Multisite: Programmatically Activate / Deactivate a Plugin of a Specific Blog
- Login problem after installing my written plugin [closed]
- remove all submenus from plugin
- Hook for page Request?
- composer not working on my plugin when i upload it to my website
- What is the WordPress approach to custom data?
- Plugin showing error
- How to render a template file using shortcode inside a plugin
- How to rewrite URL and get the values?
- Delete data from custom table when deleting a post
- Disable plugin visibility at the plugin directory
- How to deactivate my plugin upon deactivation of NextGen
- How to overwrite the category template in a plugin
- Can I add Short Code Of A Plugin In The Code Editor of WordPress?
- Content-Security-Policy implementation with WordPress W3Total Cache plugin installed
- Custom Plugin: How to Include Install Buttons of other 3rd Party Plugins?
- How to write different events from different functions in my file to a log file in WordPress
- Create a form and have custom menu display based on user answers?
- How to make a plugin api route have permission?
- Modify Plugin PHP Class in Child Theme – Correct Method
- Hook on widget context plugin to add custom context for widget
- Problem with conditional woocommerce custom checkout field
- mailjet plugin – extend functionnalities and reuse api
- Customize a widget position
- Change wp_mail SMTP settings for each E-Mail
- WordPress Thumbnail add action if no thumbnail
- conditional tags for the output of a plugin
- Creating fields in the database
- Scrolling Ads? Live scrolling widget, not random on refresh
- Pass strings to plugin function [closed]
- contact form 7 captcha support anyother captcha plugin? [closed]
- Allow manage_options capability for specific user only for specific plugin?