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?
- Custom Dynamic Tag in Elementor not showing image
- Elementor: Exclude product categories when using “Source: Current Query”
- Make id column as AUTO INCREMENT on plugin activation
- How to Include a Loop Template File in a Plugin
- Write to / remove from default .htaccess file from plugin?
- Update Option Error: Notice: Undefined index
- How can I display a contact form for out of stock products in WooCommerce?
- Pass a php string to a javascript variable
- get shortcode value
- How to get number of Affected rows from wordpress dbDelta() function
- Show price with Geo IP location
- WordPress Ajax Callback
- Add category to body class
- Plugin Development sqlite or WordPress’ database
- How to review WordPress website php version compatibility?
- printf – problem to understand code
- Custom Post Type Plugin not loading category template and loading 404 instead
- Sending email from inside a plugin using PHP PEAR
- Auto delete WordPress users according to time
- I wrote my plugin. How to display the result of the plugin’s function to sidebar (widget?)?
- How to cancel WordPress’ action/filter when using OOP with anonymous callback
- WordPress Plugin Page is Loading in Admin Content Container Instead of Separate Page
- How to trigger $_GET request within admin plugin page?
- Wp favorite posts get user favorites in profile using buddypress [closed]
- WAMP to XAMPP WordPress transfer
- Storing Options in a Shortcode
- Why isn’t admin_notices displaying my text? [Simple Plugin, Beginner]
- Determine Registered Admin Menus
- How to generate video out of images via WordPress plugin
- How to make an interface similar to multi-site for switching between multiple (single) sites for administrators?
- How can I get WordPress to save comments in markdown format?
- add_query_arg not working
- problems with wordpress and php version 5.3.3-1
- WooCommerce get_price returning wrong price when used via ajax
- How to ‘clone’ a wp plugin to make small changes
- Open Post Thumbnail in New Child Theme File in WordPress
- add mediaelement.js plugins into WordPress video player control bar
- Shortcode button dosent work for all posts. Work for first post only
- Where should I save an API key of my user when installing my plugin?
- Prevent a plugin from being automatically activated
- Is Wrapping intval() Around esc_attr() Redundant for Escaping Input?
- Programatically download a plugin
- Accessing post’s meta data based on user’s click of a post
- Error shown for Trying to get property ‘roles’ of non-object in WordPress After Content for User Roles
- Preferred way of cacheing a value in php
- Redirecting to home page after login as custom role WordPress
- WordPress Redirect Not Working – AJAX Callback Response Not Picked Up
- How to Use Parameters with a Do_Action Function Within PHP Tags
- Add keywords meta to index.php page
- Custom form action to handle data inside a plugin
- How to remove html code in excel downloads using phpspreadsheet with wordpress plugins shortcode
- Add Product Subtitle to Woocommerce Product Page
- Self deactivate plugins after an action occurs
- How to check if you are on widget.php page?
- wp_redirect() not working in Insert PHP plugin in WordPress
- Download any file after submitting a form [closed]
- Pulling data from custom plugin settings using PHP shortcode and Javascript
- I have no idea “How change font for elements in widget?”
- woocommerce 3.2.1 not sending order notification emails
- WordPress takes too much time (100 seconds) to load – Front end and back end
- Widget for adding HTML markup to a page
- WordPress on AWS with ELB
- Saving changes in wp_editor
- Executing my function once on a specific time
- Set Post Format if find a string in title or post content
- The plugin generated 3 characters of unexpected output during activation
- Display data on Word Press site posts and pages from mysql table
- Notepad sticky plugin
- How to save additional user data as part of the registration process?
- Output array into one table cell
- WooCommerce Custom Product to checkout
- How to periodically scrape and cache strings from remote txt files. – My First Plugin