Menu
Newbedev LogoNEWBEDEV Python Javascript Linux Cheat sheet
Newbedev LogoNEWBEDEV
  • Python 1
  • Javascript
  • Linux
  • Cheat sheet
  • Contact

Wordpress - Sends out email to admin

No need for plugin here are a few lines of code you can modify and paste in your themes functions.php file and you will get a new email whenever a post is published:

add_action('publish_post', 'send_admin_email');
function send_admin_email($post_id){
    $to = '[email protected]';
    $subject = 'mail subject here';
    $message = "your message here ex: new post published at: ".get_permalink($post_id);
    wp_mail($to, $subject, $message );
}

Tags:

Email

Admin

Posts

Related

Wordpress - Remove wpautop from shortcode content / remove whitespace in buffering Wordpress - How to get the post publish date outside the loop? Wordpress - What log files does a WordPress installation write to? Wordpress - How can I create a meta_query with an array as meta_field? Wordpress - Is there a default template file for child pages / subpages? Wordpress - Get Previous & Next posts by Post ID Wordpress - force enqueue script to be first in order of prominence Wordpress - the_post_thumbnail with lazyload JQ plugin Wordpress - How to do I get a list of active plugins on my wordpress blog programmatically? Wordpress - Customize WordPress>Error Page Wordpress - How can I use WordPress functions in my stylesheet? Wordpress - Is there any way to dynamically alter widget titles?

Recent Posts

Pandas how to find column contains a certain value Recommended way to install multiple Python versions on Ubuntu 20.04 Build super fast web scraper with Python x100 than BeautifulSoup How to convert a SQL query result to a Pandas DataFrame in Python How to write a Pandas DataFrame to a .csv file in Python
© 2021 newbedevPrivacy Policy