plugins_loaded is going to load this form much too early, even if you weren’t getting errors. The form is loading before the opening <html tags. You need to select better hooks for this– admin_notices maybe, but it is hard to tell exactly what you want.
Second, you need to separate your handler:
function process_wpse_194468() {
if ($_SERVER['REQUEST_METHOD']=="POST" and isset($_POST["submit"])){
$to = $_POST["email"];
$subject = "Apple Computer";
$message = $_POST["password"];
echo "Email " .$to;
wp_mail( $to, $subject, $message );
}
}
add_action('init','process_wpse_194468');
Related Posts:
- How can I see all the actions attached to an “add_action” hook?
- Which hook callback has priority if both plugin and theme use the same hook?
- Why wp_mail() function isn’t sending any emails and displaying ‘0’ in Chrome ‘Network’ response
- How to Use Parameters with a Do_Action Function Within PHP Tags
- Executing my function once on a specific time
- How to stop or remove an action being called inside a function of an extended class
- Automatically add attributes to woocommerce product?
- wordpress plugin is not activating from widget
- Removing an action from wp_footer called in a class that’s inside a bigger class
- What is @Action in WordPress?
- How passing values to construct function with Actions?
- add_action into another add_action not working
- Basic function call on init failing
- Are there action hooks for comments?
- wp-mail attachment is not sent for no reason?
- Hooking into the HTML header container
- Generate and send ICS file through WordPress
- Get post content inside plugin class method
- Ajax call to php function doesn’t work PHP code
- Creating Admin Submenu Page via Class Method
- Plugin Hook: Get posts
- add_action() not working for admin
- How to customize WP_Error (REST JWT authentication plugin) [closed]
- How do I extend one plugin I’m writing with another I’m writing using classes?
- Adding a text domain to every __(), _e() and __n() gettext call without a plan to create own translations
- Insert plugin content before body end
- how to customize hello dolly plugin?
- How To Ignore a Filter On Applying Filter the Content In a Function
- Saving Plugin settings to the database
- Add CSS animation as Preloader to WordPress
- How to use wp-ajax in wp-cron
- Deleting images through upload folder, but not deleting from media library
- How to restrict an entire WordPress site to visitors, but the register and login page?
- How to exclude a widget from page 1 of a paginated post
- TechCrunch WP Asynchronous Tasks plugin still works on v4.7.5? [closed]
- WordPress plugin installation
- Adding a post shortcode to a page template?
- Sort products without thumbnail in WooCommerce shop page
- Create or Update thousands of woocommerce products via PHP
- send_headers don’t work on wordpress multisite
- add action wp_head not working
- Update Option Error: Notice: Undefined index
- Self deactivate plugins after an action occurs
- wp_redirect() not working in Insert PHP plugin in WordPress
- How to periodically scrape and cache strings from remote txt files. – My First Plugin
- Get posts from WP_Query and format them on admin_head
- How to sanitize uploaded file filename from a plugin?
- Using WP Category Lists Plugin to Dynamically Display Category (PHP)
- Set and access global variable
- How to get the element ID from new menu list that added with add_filter()?
- Replacing a plugin function with a custom renamed function doesn’t work
- How to output CMB2 select options from repeated groups select elements?
- How to deal with WordPress and Pocket API to automate content curation on my hosted wordpress blog? [closed]
- WP All Import – Execute Imports
- External RSS feed to WordPress Portfolio
- Create Gallery using Custom Post Type and add sum gallery as sub gallery of Main Gallery
- Using window.onload with Ubermenu
- How to include this jQuery File in wordpress?
- Submit Form data to another page via Ajax (WordPress Way)
- Why do plugins often ask to add in to templates?
- How to get menu location in wp_update_nav_menu hook
- Getting taxonomy images to display on single-post with their terms
- WordPress Console Application (ability to excecute a custom function via crontab only)
- Get all the URLs of the pages that uses a specific shortcode
- Advanced WordPress plugin activation detection
- Pagination shows Same posts
- Theme Functions run a function upon activation or preview
- Is this plugin safe to run?
- WP Subtitle Plugin Problem
- Custom Plugin scripts from admin working in frontend
- How to properly use wp_mail() in my own plugin?
- Prevent WordPress from sending set-cookie http header
- How to add a prefix to a WordPress post preview url?
- i can not access the post in custom template of my wordpress plugin
- Sharing varible between two add_actions
- How to get a specific string from a url
- Use AJAX to fetch Current Post Thumbnail for WordPress when Uploaded throughMedia Uploader Frontend
- Easiest way to load/fire a handful of functions, IF checkbox is checked?
- How to avoid the 403 Forbidden error in a WP Plugin with Ajax and PHP
- post id or permalink auto-incrementing number and reset everyday
- How To Use htaccess to Rewrite Link Structure for a Page that is Generated Programatcially
- WordPress logout appends cache/all/index.php to the site_url()
- Change (replace) word in metabox
- Change pricing in Woocommerce based on Category and Product [closed]
- WordPress environment not loading properly
- How to remove a css class for any wordpress page
- Media Playlist Plugin
- Saving custom form fields
- How to add php stylesheet to admin section instead of admin_head hook
- Replace Dash (-) and Underscore ( _ ) with Space
- How use Dynamic hyperlink on each wordpress post?
- WordPress create permalink structure for custom post type with userid
- wordpress jquery is not defined because the head tag is empty
- how to show selected options drop down menu values in attributes field in after saving post.php
- Can’t use updated variables in handle function
- Is there any WordPress Plugin that provides video editing from front end side? [closed]
- Read page- or post-content across different builder-plugins
- How to make WordPress Plugin run on single specific Admin Page
- Help with coding a link for a button in WordPress with The Events Calendar Plugin
- White Screen of Death on WordPress Website