Best 2 Know

The Ultimate Blogging Resource

  • Advertising
  • WebHosting
  • Contact Us
  • Blogger
    • Blogger Templates
    • Blogger Tutorials
  • Browser
    • Firefox
    • Google Chrome
  • Google
  • Internet
    • Facebook
    • Twitter
  • Thesis
  • Windows
  • WordPress
    • WordPress Themes
    • WordPress Plugins
  • More
    • Linux
    • Review
    • Solutions
    • Announcements

How to Automatically notify users on new post

Do you ever wish to send your registered user’s an email whenever you do a new post , well this is basically very useful if you have a big list of user registered on your WordPress blog

So now lets implement this hacks go to functions.php and add the below code

function email_members($post_ID)  {
    global $wpdb;
    $usersarray = $wpdb->get_results("SELECT user_email FROM $wpdb->users;");
    $users = implode(",", $usersarray);
    mail($users, "New Post on WordPress Den", 'A new post have been published on http://www.wpden.net');
    return $post_ID;
}

add_action('publish_post', 'email_members');

Just edit the above code at line 5 to what ever you want

Subscribe via Email

Share this:

  • Twitter
  • Facebook
  • Pocket
  • Print
  • WhatsApp
  • Email

Related

June 23, 2011 Ritesh Sanap WordPress Notify users, Notify wordpress users, Tricks, wordpress, wordpress hacks

Comments

  1. Cebu Tech Blogger says

    July 26, 2011 at 2:38 am

    Hi, how about if you just want to notify specific users on a new post? Is it possible with the code above?

    Reply
    • Ritesh Sanap says

      January 20, 2012 at 7:05 pm

      No the above code only sends mails to all the users

      Reply
  2. mirditori says

    April 5, 2014 at 6:46 am

    Adding to this conversation another plugin i found is this
    http://codecanyon.net/item/live-post-page-product-notification/7365533

    Can you tell me a bit more about that ?

    Regards

    Reply
    • Ritesh Sanap says

      April 12, 2014 at 9:22 am

      the details regarding this plugin can be found on its descriptions page, the plugin shows live notification of the new posts unlike sending email, you can think of the plugin like showing facebook updates.

      Reply
  3. Bruno Accioly says

    May 7, 2014 at 1:43 pm

    What if I wanted to make show a hidden DIV for the user every time a post was published?

    Any hints on that?

    Reply
    • Ritesh Sanap says

      July 14, 2014 at 11:18 am

      What you are saying is possible but it is more complex where it requires a seperate table in mysql to keep track of users who have viewed post and AJAX (Optional) to notify users on the site in real time. whereas the above solution is quite simple and uses WordPress.

      if you want live notifications follow the link posted by “mirditori” in the comments. I guess that will be your best bet, you can install that plugin and afterwards you can tweak it to show the div like you want.

      Reply

Leave a Reply Cancel reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Post navigation

Previous Previous post: WordPress SEO Plugin by Yoast
Next Next post: BlackSpire WordPress Theme

Currently Trending

  • How to download Specific parts of YouTube videos
  • How to Change the Welcome/Login Screen in Windows XP ?
  • h4x0r ( Hacker ) - Blogger Template
  • Windows Vista CD key
  • Add/Remove page/Post View Counter Widget For Blogger
  • Free Online Angry Birds game
  • How to Make Your Own Avatar
  • How to Download Documentation for offline viewing - Dash
  • How To Change Windows XP Shutdown Dialog Box

Get Latest post in your Inbox

Random Posts

How to Delete a FaceBook Page

December 4, 2012 By Ritesh Sanap Leave a Comment

How to get Rid of spam comments

May 5, 2011 By Ritesh Sanap 4 Comments

How to Remove Read More jump

June 21, 2011 By Ritesh Sanap Leave a Comment

Using WordPress Media Uploader in Plugin or Theme

June 25, 2011 By Ritesh Sanap Leave a Comment

How to Disable the Zoom Level Option in Internet Explorer

May 22, 2010 By Ritesh Sanap 2 Comments

WordPress

HTTP2 Server Push for W3 Total Cache Minify plugin

August 17, 2016 By Ritesh Sanap 5 Comments

How to Disable Emojis in WordPress

January 6, 2016 By Ritesh Sanap Leave a Comment

JetPack Related posts and Sharing not working with NGINX

November 10, 2015 By Ritesh Sanap Leave a Comment

Simply Pure – WordPress Theme

November 2, 2014 By Ritesh Sanap 2 Comments

Advanced What should we Write about next? – WordPress Plugin

July 28, 2014 By Ritesh Sanap Leave a Comment

How to Disable Self Pingback or TrackBack

January 16, 2014 By Ritesh Sanap Leave a Comment

BlueStrap – WordPress Theme

January 1, 2014 By Ritesh Sanap 15 Comments

How to Create Multiple Excerpts in WordPress

December 24, 2013 By Ritesh Sanap Leave a Comment

How to Disable Auto Update in WordPress

November 21, 2013 By Ritesh Sanap Leave a Comment

How to Delete Feedbacks from JetPack Contact Form

November 19, 2013 By Ritesh Sanap 9 Comments

Recent Posts

  • HTTP2 Server Push for W3 Total Cache Minify plugin
  • How to show hidden files and folders in Mac OS X
  • How to Disable Emojis in WordPress
  • Canva – Online Photo Editor
  • JetPack Related posts and Sharing not working with NGINX

Archives

Recommends

  • DigitalOcean – Cloud Hosting
  • Dropbox – Cloud Storage
  • Elegant Themes – WordPress Themes
  • LastPass – Password Manager
  • Like us on Facebook
  • Follow on Twitter
  • +1 on Google
  • Subscribe via Email
  • RSS Feed

© 2023 Best 2 Know · All Rights Reserved · We ♥ DigitalOcean