Send email from WordPress

Try to add some code to the functions.php like: add_action(‘publish_post’,’send_email’); function send_email() { // write some code with wp_mail function. } I think you can use the $post to get the post info. For comments I guess you can use: add_action(‘comment_post’, ‘send_email’); Let me know if you need some more help!

automatic send email at custom time

Creating a Scheduled Event First we’ll create a function that will schedule our event. Mine is called “mycronjob” and it will run once every day. All this code can go into your plugin’s main file, outside the main function: // create a scheduled event (if it does not exist already) function cronstarter_activation() { if( !wp_next_scheduled( … Read more

plugins_loaded action is not working properly

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() { … Read more