That if('POST'...) just alone -in the middle of the plugin code- doesn’t seem right. You can hook into load-$pagenow and process the form submission there:
add_action( 'load-index.php', 'check_posted_data' );
function check_posted_data()
{
if( 'POST' == $_SERVER['REQUEST_METHOD'] && !empty( $_POST['my_prefix_message'] ) ) {
wp_die( "I'm here! {$_POST['my_prefix_message']}" );
}
}
Please note that you’re missing security checks and proper prefixes to your data.
And as a side note, I would solve this with Ajax.
Related Posts:
- How can I make my custom shortcode work in a Custom HTML Widget?
- Delete Custom Dashboard Widgets
- How to pass JavaScript variable to PHP in wordpress widget?
- WordPress widget / plugin….fields not appearing in my widget
- Custom Widget outputs the input but doesn’t save anything inside the textarea
- Remove Widgets in Dashboard
- How can I ‘reactivate’ .PHP files within a WP plugin that have been marked ‘inactive’?
- Created Widget Not Showing up on Admin Panel
- Setting up widgets in wordpress with a unique ID for the after_title argument
- How to exclude a widget from page 1 of a paginated post
- Can I use a form in a dashboard widget?
- Missing argument 3 for wp_register_sidebar_widget()
- The called constructor method for WP_Widget in GFWidget is deprecated since version 4.3.0! Use
- WordPress Widget Not Saving Data
- How to get my plug-in, wrote in php, to refresh on its own every 5 minutes?
- Call plugin with php function
- How can i force wp-admin to use 2-column dashboard layout? [closed]
- All custom widgets are not showing in widget area at the same time
- Modify pages widget and make a plugin?
- Creating New Dynamic Fields for a Certificate (Number Generation, Code Referencing, and more)
- What is the right way to populate a dropdown from MySql?
- Why is my form going to frontend on html form submission present on the php files inside my custom plugin?
- Adding link on title its in description but not in title see screenshots attached
- Cannot access variables within a widget
- Template from scratch: Sidebars not showing widget
- conditional tags for the output of a plugin
- How to add homepage Widget?
- What can I do to customize a widget provided with this plugin? from where have I to start?
- Customizing subject in comment notification e-mails
- Plugin or mod for wordpress to make content publication SUPER easy
- Cropping, Re-sizing and Saving images from one folder to another folder in wordpress
- How to develop a community feature in the dashboard for multiauthor site
- Using the media uploader in a custom plugin
- Creating search filter through plugin
- Can I check plugins and themes for PHP 5.6 ahead of global PHP server Update
- How can I reuse the WordPress search form for a custom plugin / widget?
- Passing $this->get_field_name() to javascript
- How can I get WordPress to save comments in markdown format?
- Shortcode button dosent work for all posts. Work for first post only
- Display data on Word Press site posts and pages from mysql table
- How make a php script run only with wp-cron
- Redirection of users away from wp-admin (but not administrators)
- Most efficient way to use classes to create admin pages using Settings API
- CMB2 toolkit: Compare 2 Dates and validate the Time
- 306 MB of wp_options occupied by WordPress SEO Plugin, is that normal? [closed]
- Perform internal redirect in WordPress?
- How to prevent plugins from loading jQuery
- How to remove admin main menu name repetition
- Using TinyMCE in plugin?
- Hide certain widgets from specific user roles in admin
- Custom widget doesn’t save values from dropdown box
- Register Script in Plugin Widget
- How to get specific string/value from an array? php [closed]
- jQuery Click event is not fired at all
- Background Music WP [closed]
- Widget for specific category
- Why is it important to check for isset and is_array before checking in_array in this example?
- ACF – How to set the menu order for the relationship field
- Custom search search does not work?
- How to call external functions from a PHP script in a WordPress plugin?
- Passing PHP Variables to AJAX Loaded Pages
- How to add custom function to pluggable.php
- WooCommerce – new order email hook
- How to list datas from database in a topic?
- How to hide an option from dropdown in filter module
- How use wp_insert_post and add og:custom tags?
- Display pagination in reservation Plugin and and Print table as pdf
- How to change “Read More” text?
- How to change a wordress plugin php code in my child’s functions.php file?
- Using id to show item
- WP Migrate DB Pro plugin cannot transfer Media files to remote server
- Woocommerce – Change variations output
- WordPress Plugin PHP Not Calling Function
- load plugin in code snippet
- Is admin section completely customizable in terms of styling?
- Creating Admin Submenu Page via Class Method
- What is the correct entry point for capturing coverage data
- How to create a dashboard for logged-in users with custom functionality? [closed]
- Show widget location borders for development
- adding image in the header of my dev widget
- How to Set Limit with WordPress Get Bookmarks Shortcode
- Postal address auto-complete on profile page
- Remove the ‘Press This’ Tool
- WordPress Related Plugin – Adding an image
- ACF: Hide a div or template section when a custom field (in a field group) is empty
- How to delete remain data in WP database after deleting custom post via admin interface
- Populate Woocommerce order notes with custom field value
- Woocommerce Product Add-ons – Auto-select first option
- Strict Standards: Non-static method in sidebar generator
- Fast Tranfering my WordPress site to another server
- Duplicating wordpress install issue
- Need help with wordpress audio preload
- Allow direct access to files/folders within WordPress to replace wp-admin
- is_singular() in mu-plugins not working
- Error 400 Invalid “products[1].productId” Kinguin [closed]
- I want to move the one click accesbility button on bottom of my website screen,
- WordPress : how to create onglet and remove it when only one
- Custom page template from plugin does not work with pre-installed themes in WordPress 6.6.1
- WordPress child theme widget customization – Eduma
- How to customize WP_Error (REST JWT authentication plugin) [closed]