How to Email Authors When Articles Are Published in WordPress

Featured Imgs 23

Do you want to email authors when their articles are published in WordPress?

If you run a multi-author blog, then notifying authors when their blog posts are published keeps them informed. Plus, it can also help increase engagement on your website since authors can quickly share their content and participate in discussions.

In this article, we will show you how to email authors when their articles are published in WordPress.

Email authors when their articles are published in WordPress

Why Email Authors When Their Articles Are Published in WordPress?

By notifying authors when their posts are published on your WordPress blog, you allow them to immediately promote their work on social media platforms and communicate with readers in the comments section.

Additionally, notifications keep authors updated about the publication statuses for different posts. This helps build trust among your team by showing that you value the writer’s contributions to your multi-author blog.

By alerting authors immediately upon post publication, you also give them the opportunity to view their content and correct any typos or errors before visitors have a chance to read it.

Having said that, let’s see how to easily email authors when their articles are published in WordPress. You can use the links below to jump to the method of your choice:

Method 1: Email Author When Their Article Is Published in WordPress Using a Plugin

If you prefer to use a plugin to notify your authors, then this method is for you.

First, you need to install and activate the PublishPress Planner plugin. For detailed instructions, you may want to see our beginner’s guide on how to install a WordPress plugin.

Note: You can also use the PublishPress Pro plan to unlock more features like Slack integration, send reminder notifications, and meta posts. This will help you improve the overall editorial workflow of your multi-author blog.

Upon activation, you need to visit the Planner » Settings page from the WordPress admin sidebar and switch to the ‘Notifications’ tab.

Once you are there, type in the admin email address that will be used to send emails to your authors next to the ‘Email from’ option.

After that, check the ‘Always notify the author of the content’ option to send emails to authors every time their posts are published on your website.

Check the always notify author option

If you also want to notify the users who edited the post, then you can check the ‘Always notify users who have edited the content’ option.

Once you are done, click the ‘Save Changes’ button to store your changes.

Now, when you publish an author’s post, they will receive an email notification that looks like this:

Preview of author email notification upon post publication

Method 2: Email Author When Their Article Is Published in WordPress Using Code

If you don’t want to use a plugin, then you can also automatically send emails to authors by adding code to your theme’s functions.php file.

However, the smallest error when adding code can break your website and make it inaccessible.

That is why we recommend always using WPCode. It is the best WordPress code snippets plugin on the market that makes it super safe and easy to add custom code to your website.

First, you need to install and activate the WPCode plugin. For details, you can see our step-by-step guide on how to install a WordPress plugin.

Note: You can also use WPCode’s free plan for this tutorial. However, upgrading to the pro version will give you access to more features like a code snippets library, conditional logic, CSS snippets, and more.

Upon activation, simply visit the Code Snippets » + Add Snippet page from the WordPress dashboard. Then, click the ‘Use Snippet’ button under the ‘Add Your Custom Code (New Snippet)’ option.

Add new snippet

This will take you to the ‘Create Custom Snippet’ page, where you can start by adding a title for the code snippet.

After that, select the ‘PHP Snippet’ option from the Code Type dropdown menu on the right.

Choose the PHP Snippet option for emailing authors upon post publication

Now copy and paste the following custom code into the ‘Code Preview’ box:

function notifyauthor($post_id) {
 
$post = get_post($post_id);
$author = get_userdata($post->post_author);
$subject = "Post Published: ".$post->post_title."";
 
$message = "
      Hi ".$author->display_name.",
       
      Your post, \"".$post->post_title."\" has just been published.
       
      View post: ".get_permalink( $post_id )."
       
      Thanks"
      ;
       
   wp_mail($author->user_email, $subject, $message);
}
add_action('publish_post', 'notifyauthor');

This code runs when a new post is published in WordPress. It sends an email notification to the author using the subject and message defined in the code. Feel free to change the subject and message fields to meet your needs.

Once you have done that, scroll down to the ‘Insertion’ section and choose the ‘Auto Insert’ mode. The code will be automatically executed on your website upon activation.

Choose an insertion method

Finally, scroll back to the top and toggle the ‘Inactive’ switch to ‘Active’.

After that, click the ‘Save Snippet’ button to store your settings.

Save the snippet for emailing authors upon post publication

Now, when you publish a post, the author will automatically receive an email notification.

It will look like this:

Preview for sending email notification to authors upon post publication

Bonus: Use WP Mail SMTP to Send Your Emails

When you send emails to your authors about their published posts, you are using the default WordPress email settings, which are not always reliable.

This means that your email may not reach the author or might even end up in their spam folder.

To fix this issue, you can use WP Mail SMTP, which is the best WordPress SMTP plugin on the market. It uses the SMTP (Simple Mail Transfer Protocol) method for mail transmission and eliminates your email delivery problems.

WP Mail SMTP website

You can easily connect WP Mail SMTP with popular email marketing services and make sure that your emails reach the user’s inbox immediately.

With WP Mail SMTP, you can easily avoid the spam folder, track your email logs, use backup connections and failure alerts, and use premade templates to send emails to your users.

For detailed instructions, you can see our beginner’s guide on how to properly configure your WordPress email settings.

We hope this article helped you learn how to email authors when their articles are published in WordPress. You may also want to see our tutorial on how to highlight author comments in WordPress and our expert picks for the best free author bio box plugins in WordPress.

If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.

The post How to Email Authors When Articles Are Published in WordPress first appeared on WPBeginner.

How to Retrieve WiFi Password on Windows

Featured Imgs 23

Remembering the WiFi password when on a guest network is never easy. Even worse is when it’s no longer posted and someone else is asking you for it. Luckily there’s a built in Windows command to recover the password of a given WiFi network.

The Shell Code

Open cmd and execute the following command:

netsh wlan show profile name="David Walsh's Network" key=clear

The result of the command, assuming the network is found, is a long text output with a variety of information about the network. To get the see the password for the network, look under the “Security settings” heading which will look like this:

Security settings
-----------------
    Authentication         : WPA2-Personal
    Cipher                 : CCMP
    Authentication         : WPA2-Personal
    Cipher                 : GCMP
    Security key           : Present
    Key Content            : **THE_PLAIN_TEXT_PASSWORD**

As with any complicated command line format, it’s best to create an alias so that you don’t need to remember the full string!

The post How to Retrieve WiFi Password on Windows appeared first on David Walsh Blog.

How Is AI Revolutionizing the World of Internet of Things?

Featured Imgs 26

In the digital era, the combination of AI and IoT has given rise to an inspiring technological phenomenon. AI, with its ability to simulate human intelligence, combined with IoT. It is revolutionizing the world in ways that were once only imaginable in science fiction. 

This dynamic duo is transcending boundaries and, as a result, reshaping industries and creating a smarter, more interconnected world. This blog explores AI transforming the realm of IoT. Also, tell you the profound impact it is making on various Aspects of our lives.

How to Create a Gallery in WordPress

Featured Imgs 21
create a gallery in WordPressWhether you’re a photographer, artist, or someone who just wants to display some images in an interesting fashion, online galleries are the tool of choice. In this guide on how to create a gallery in WordPress, we’ll look at two easy methods for adding them.

Prometheus vs. Grafana in 2023: A Detailed Comparison

Featured Imgs 26

Prometheus and Grafana are two big names in the open-source world of observability. Both are widely liked and used, with vibrant, opinionated communities, and they routinely build on top of each other.

So, how do Prometheus and Grafan stack up against each other? In this blog, we’ll compare them and examine:

Advanced and Dynamic Searching With Spring Data JPA

Featured Imgs 26

I have often been asked to develop advanced search services. By advanced search, I mean searches in which it’s possible to apply multiple filters on all (or almost all) fields such as like, between, in, greater than, etc.

So imagine having to build a service based on one or more entities capable of offering an endpoint that can be called like this (start keeping an eye out for special suffixes <propertyName><_suffix>):

Solving Media Object Float Issues With CSS Block Formatting Contexts

Category Image 052

Let’s imagine we’re making a small component. It can be anything, really, but let’s use a media object as an example. Nicole Sullivan had a solid definition of media objects from way back in 2010, and you probably already know the pattern well: some form of media (often an image) on the left and text beside it on the right. The media could be an image or a video, for example.

This is the basic HTML for the layout, minimized for brevity:

<section class="container">
  <article class="float-left">
    <img src="https://picsum.photos/100">
      <p>I've never had to cook or clean since I discovered Xyz. They perform all my tasks for me. I recommend them.</p>
      <h3>Dan Somore</h3>
  </article>

  <!-- more articles -->

</section>

This HTML gives us a <section> element that is the container for four <article> elements, where each one is a testimonial container that holds an <img> and a <div> with a block of text — our media objects.

Let’s apply some light styling in CSS:

/* Give the parent container breathing room */
.container {
  padding: 20px;
}

/* 
  Styles for each testimonial container 
  Each container is floated left
*/
.float-left {
  border: 2px solid blue;
  background-color: transparent;
  float: left;
  width: 45%;
  min-height: 150px;
  margin-bottom: 20px;
  margin-right: 20px;
}

/* Testimonial images are floated left */
img {
  float: left;
  margin-right: 10px;
}

This code is by no means perfect. In fact, it introduces the wrapping and overflow issues we’re about to discuss. We will look at these issues together before getting into solutions.

Issue 1: Height Collapsing

When an element is floated in its container, it exits its normal document flow and into a floated position, making no contributions to the container’s height. In a container of many floated media objects, the container element’s height is collapsed to contain only non-floated elements. The collapsed height might be inconspicuous in containers without a border or non-floated elements and could disrupt the layout of other elements after a media object container. However, this issue can be easily discovered if there is a non-floated element in the container, among other floated elements.

Let’s add a border to the parent container to see the height-collapsing effect.

The height of the content is what influences the height of the testimonial container. If the image were in the container’s flow, it would be taller than the text, and the container would adjust to it. But, alas, that’s not the case since we introduced a block formatting context when floating the image.

The popular solution with a single line of CSS on the testimonial’s parent container:


.container {
  overflow: auto;
}

The BFC this generates establishes a new document flow within the page’s root element, containing all the container's child elements, including floated media objects. It effectively prevents the testimonial elements from being displaced beyond the parent container’s borders — no extra divs or pseudo-elements are needed like the clearfix approach.

See the Pen Float Solutions: overflow: auto [forked] by Geoff Graham.

That certainly gets the job done! But I want to show you one more way to do this because I believe it’s the best of the bunch.

The Best Solution: display: flow-root

display: flow-root was introduced to address inconsistencies associated with using overflow for generating BFCs. In fact, display: flow-root was explicitly designed to produce BFC, while the overflow property is designed to manage content that surpasses its container. Consequently, overflow can induce unintended side effects, from unwanted scrollbars to data loss.

That’s why I recommend using display: flow-root. It is meant to create a BFC when you need it, whereas the other solutions are more like workarounds.

Conclusion

CSS block formatting contexts are great because they allow you to leave the main document flow, allowing elements to interact differently in a layout. But, of course, those different interactions can feel like buggy behavior if you’re unaware that you’re actually working in a different formatting context.

This is exactly why we have modern layout techniques like Flexbox and Grid. Before we had them, floats were a nice trick for faking columns. But the BFC they created wasn’t so nice. Hence clever workarounds like the clearfix to create a BFC to wrangle the other BFC.

Perhaps the bigger takeaway from all this, though, is to evaluate your layout strategy. If you’re reaching for a float, is it really the best option for what you’re trying to do? Because if so, you may as well embrace the natural text-wrapping behavior rather than trying to fight it. And if you don’t want to fight it, that’s a sure sign you ought to reach for a more modern layout technique, like Flexbox or Grid.

Resources

Further Reading On SmashingMag

An Introduction to Subscription Options in MQTT

Featured Imgs 26

In Introduction to MQTT Publish-subscribe Pattern, we learned that we need to initiate a subscription with the server to receive corresponding messages from it. The topic filter specified when subscribing determines which topics the server will forward to us, and the subscription options allow us to customize the forwarding behavior of the server further.

In this article, we will focus on exploring the available subscription options in MQTT and their usage.

WooCommerce vs Magento: Which Is Better for Ecommerce?

Set Up Woocommerce
WooCommerce vs MagentoIf you're starting an ecommerce site, you'll need a platform that can help you run your online business efficiently. There are many options available, but WooCommerce and Magento consistently show up on short lists. To cut through the fog and simplify things for you, we've put together a detailed comparison of these two popular ecommerce platforms.

Does Tools give 100% correct answers?

Featured Imgs 11

Hello Everyone!
Let's have a debate about does tools like Semrush, Ahrefs etc give 100% correct information? Like you do not need anything else besides these tools?
I already know the answer just looking for your insights.

Static Proxies or Rotating Proxies: Which One Should You Choose?

Featured Imgs 26

Data center proxies come from servers in data centers, while residential proxies come from real people's connections. Static proxies mostly come from data centers, while rotating proxies are residential, although there are exceptions for Residential proxies.

Both IPv4 and IPv6 addresses can supply static and rotating proxies, but static IPv4 proxies may be harder to come by since they've all been assigned. IPv6, on the other hand, has trillions of available IP addresses.