Easy Guide to Let Contributors Edit Their WordPress Posts After Being Approved

In this tutorial, we will show you how to let contributors edit their posts after being approved.

Let Contributors Edit Their Posts After Being Approved

Contributors or guest authors with contributor user role write posts and send them to review in WordPress. A user with the administrator or editor user role can review and publish it. Once published, the contributors are unable to edit their own posts. This is a generalized hierarchy in WordPress that distribute user role and status.

However, you can add or remove capabilities to user roles in WordPress. Let’s take a look at how to let contributors edit their published posts.

Method 1: Allow Contributors to Edit Their Posts (Plugin)

This method is easier and recommended for most users. This method also allows you to edit other user roles and permissions right away.

First thing you need to do is install and activate the Capability Manager Enhanced plugin. For more details, see our step by step guide on how to install a plugin in WordPress.

Upon activation, you need to visit Users » Capabilities in your WordPress admin area to edit capabilities of contributor user role.

On this page, you need to select Contributor role on the right side, so you can change their permission level.

Once selected, you’ll see a lot of options in this section. In the Editing Capabilities area, you need to select Edit Published option and scroll to the bottom to click on Save Changes button.

After that you can test the permissions by switching to a contributor role in WordPress and going to the Posts page. You will now see the option to edit published posts. Hint: you can instantly switch between user accounts while testing roles and permissions in WordPress.

Method 2: Manually Allowing Contributor to Edit Their Posts

This method requires you to add code to your WordPress files. If you haven’t done this before, then please take a look at our guide on how to copy and paste code in WordPress.

You’ll need to add the following code to your WordPress theme’s functions.php file or site-specific plugin.

// get the "contributor" role object
$obj_existing_role = get_role( 'contributor' );
 
// add the "Edit published posts" capability
$obj_existing_role->add_cap( 'edit_published_posts' );

This code snippet needs to run only once which means you can save it and then delete it. It will allow contributors to edit their published posts in WordPress.

Even though we have shown you how to allow contributors to edit their published posts, we believe it is not a good practice to let contributors or authors edit their published content.

If there’s a need for any change or correction in the content, then the writer should ask an administrator or editor to update it. This allows you to maintain editorial integrity.

Before publishing a post, an editor checks multiple necessary elements like keywords, images, meta description, URL, and more. These things are important to get better rankings in search results. A user with a contributor user role may not be fully aware of your editorial best practices and can make mistakes that would go unnoticed if not reviewed by an editor or administrator.

One way to deal with this is by sharing a blog post checklist with your contributors and authors. This checklist will help them cover all the tasks before submitting a post to review. It will also help an editor to quickly review a post.

We hope this tutorial helped you learn how to let contributors edit their posts after being approved.

Easy Guide to Easily Accept Credit Card Payments on Your WordPress Site

In this article, we will show you how to easily accept credit card payments on your WordPress site.

 

Note: You will need to enable HTTPS / SSL on your website to accept credit card payments.

Accepting Credit Card Payments in WordPress without Shopping Cart

Often users don’t want to setup a full-fledged shopping cart to accept credit card payments. This makes a lot of sense specially if you’re only selling a single product or accepting payments for consulting / services.

In this case, all you need is an online order form with a credit card payment option.

Here is how you can easily accept credit card payments without adding a shopping cart to your website.

First thing you need to do is install and activate the WPForms plugin. For more details, see our step by step guide on how to install a WordPress plugin.

WPForms is the most beginner friendly WordPress form builder plugin. While they have a Lite version that’s free, you will need their PRO plan to access the payment add-ons.

Upon activation, you need to visit WPForms » Settings page to enter your license key. You can find this information in your WPForms account area.

Next, you need to head over to WPForms » Addons page and locate the Stripe addon. Go ahead and click on the ‘Install Addon’ button and then click on the ‘Activate’ button.

Stripe is a credit-card processing platform that makes it easy for businesses to accept credit card payments on their website. WPForms makes it easy to connect your WordPress website to Stripe.

Once the Stripe addon is activated, we need to connect WPForms to your Stripe account. To do that, head over to WPForms » Settings page and click on the ‘Payments’ tab.

You will need to enter your Stripe API keys. You can find this information in your account settings on Stripe’s website.

Don’t forget to click on the ‘Save Settings’ button to store your changes after entering the API keys.

WPForms is now ready to accept credit card payments. Let’s create an online billing or order form that you can add to your website for accepting credit card payments.

Head over to WPForms » Add New page. From here you need to provide a title for your form and then select ‘Billing / Order Form’ template.

WPForms will pre-load the form builder with a billing/order form template with commonly used fields. You can point and click to edit any form field. You can also add new fields from the left column.

Next, you need to scroll down to the Payment Fields section in the left column. From here you can add payment related form fields.

WPForms allows you to add multiple items as well as single items that users can order. You can click on the item field to change item details and pricing.

After editing item details, go ahead and click to add the credit card field to your form.

Now that your form is setup, let’s enable payments for this form. To do that, you need to click on the Payments tab on the left and then select Stripe.

You will need to click on the checkbox next to ‘Enable Stripe payments’ option and provide a description of the payment. Optionally, you can send an email receipt to your users by selecting the email field from the drop-down menu.

Next, you may want to receive an email notification for new orders and purchases. You can also send a confirmation email to notify the user that you have received their order.

Let’s setup notifications for your billing form.

You need to start with clicking the ‘Settings’ tab on the left and then select ‘Notifications’. You will notice that WPForms has already created a notification that sends an email to your WordPress admin email address when a new order is placed.

You can edit this notification message. For example, you can provide additional email addresses, change email copy, subject, and more.

If you want to send a separate notification to your users, then click on the ‘Add New Notification’ button.

You will be asked to provide a name for the new notification. Let’s call it ‘Customer Notification’. After that you will see the notification fields that you can edit.

You need to click on the ‘Show Smart Tags’ link next to ‘Send to email address’ option and select the ‘Email’ field. This allows WPForms to use the email address that your customer provided when submitting the form.

You can edit rest of the notification email by providing a subject line and message. You can also use smart tags to use the form fields submitted by the user to add item details, user’s name, and other personalized information.

Once you are done, you can click on the save button at the top and exit the form builder.

Your online credit card payment form is now ready, and you can add it to any WordPress page on your site.

Simply edit a page or create a new one, and then click on the ‘Add Form’ button above the page editor.

This will bring up a popup where you can select the order form and click on the add form button to continue. WPForms will now enter the required shortcode to your post edit area.

You can now save or publish your page and click on the preview button to see your form in action.

Note: Don’t forget to test your form to make sure everything is working fine. If you are unable to send or receive email notifications, then follow the instructions in our guide on how to fix WordPress not sending email issue.

WPForms is the simplest way to accept credit card payments in WordPress, and it is the easiest way to create just about any type of form in WordPress. This is why it ranks #1 in our list of the best WordPress contact form plugin. WPForms has over 1 million active installs and a 4.9 out of 5 star rating average.

If you don’t want to use Stripe, then you can also use PayPal to accept credit card payments using the WPForms PayPal addon.

However a simple payment form isn’t a perfect solution for everyone. Based on use-case, you may need a different solution for accepting credit card payments on your website. Here are some other ways to accept credit card payments in WordPress.

Accepting Credit Card Payments in an Online Store

If you want to add a shopping cart and sell multiple items, then you will need an eCommerce plugin like: WooCommerce. It is the best WordPress eCommerce plugin on the market. WooCommerce makes it easy to sell things online and accept credit card payments.

For complete step by step instructions, see our guide on how to start an online store for beginners.

Accept Credit Card Payments on a Membership Website

If you want to build a membership website to sell membership subscriptions and paid content, then we recommend using MemberPress. It is the most powerful WordPress membership plugin that easily integrates with Stripe, PayPal, or Authorize.net to accept credit card payments on your website.

Here is a complete guide on how to create a membership website with step by step instructions.

Accept Payments by Selling Online Courses

If you want to sell online courses, then we recommend using LearnDash. It is the best LMS plugin for WordPress and allows you to process credit card payments on your website.

For details, see our guide on how to how to sell online courses with WordPress with step by step instructions.

We hope this article helped you learn how to accept and process credit card payments in WordPress.

Easy Guide to Install WordPress on Amazon Web Services

In this article, we will show you how to install WordPress on Amazon Web Services.

 

Note: If you are just starting a website, then we recommend using one of the easier solutions from our how to install WordPress guide.

We have split this article in two methods. The first method is a manual process that is very technical and complicated. The second method is an easier solution for beginners because it allows you to use AWS infrastructure by going through a preferred managed WordPress hosting solution.

  1. Manually Install WordPress on AWS
  2. Install WordPress on AWS through Managed Hosting Solution

Method 1. Creating a Custom WordPress Install on AWS

First thing you need to do is visit the Amazon Web Services website. You can create a free account, but you will need to enter credit card information. Amazon will verify your identity by sending a $1 charge to your card.

Once your account is verified, you need to login to your AWS console and click on the ‘Services’ menu. Under the compute section, you need to select EC2 to continue.

EC2 is AWS’s cloud computing platform that allows you to create virtual machines and run web apps like WordPress. For more details on what’s a virtual machine, read our guide on what is a VPS and do you need it.

Next, click on the ‘Launch Instance’ button to launch and configure your instance settings.

You will need to select an Amazon Machine Image. These are pre-configured software stacks that you can install with a single click.

Under the ‘AWS Marketplace’ search for WordPress and then select ‘WordPress by Bitnami’.

You will now see a pricing popup where you simply need to click on the continue button.

On the next screen, you will be asked to choose an instance type. You can go ahead and select td.micro free tier and then click on ‘Configure instance details’ button.

On the next screen, you don’t need to change anything. Simply click on ‘Next: Add Storage’ and then click ‘Next: Add Tags’ buttons.

Now we will enter a name for this instance as a tag. Click on the Add Tag button and enter ‘Name’ as key, and ‘MyWordPress’ as value.

Click on the ‘Review and launch’ button to continue.

You will now be presented with an overview of your EC2 Instance configuration. Click on the ‘Launch’ button to start your instance.

Next, you will be asked to select pair keys. You need to select ‘Proceed without a key pair’ and then check the box below it.

After that click on the launch instances button to store your settings and launch your EC2 instance.

AWS will now show a success message. Click on the ‘View Instances’ button at the bottom right corner of the screen.

You will now be able to see your WordPress instance running.

To test your WordPress site, you need to locate its public IP address. You can find it under IPV4 Public IP column next to your instance.

You can now copy this IP address and enter it in the address bar of a new browser tab to view your website. You will be able to see your WordPress site with the default theme.

To visit your WordPress admin area, simply add /wp-admin/ next to your site’s public IP address, like this:

http://18.191.114.246/wp-admin

You will now see the default WordPress login page.

However, you will need to know the username and password to access the admin area.

You can get that by going back to your EC2 Console and clicking on the ‘Actions’ button and then select Instance Settings » Get System Log.

This will bring up a log file in a popup window with lots of text. You will need to scroll down towards the bottom, and you will find a line with ‘Setting Bitnami user password to’ surrounded by ## signs. You will also see the default username set by the app.

You can now copy the username / password and enter it on the login screen of your WordPress site.

Congratulations, you have successfully installed WordPress on Amazon Web Services. However, your website is still only accessible by using the IP address.

If you want to point a domain name to your AWS WordPress install, then you will need to connect your domain name to AWS’s DNS servers.

See our step by step guide on how to register a domain name.

Once you have registered your domain name, you’re ready to add it to your AWS instance.

Add a Domain Name to Your WordPress Site on Amazon Web Services

First, go to your EC2 instances dashboard and then from the left column click on ‘Elastic IPS’ under ‘Network & Security’ section.

Next, click on the ‘Allocate New Address’ button to continue.

You will be asked how do you want to use the IP address. Simply click on the Allocate button to continue.

AWS will now create a new elastic IP for your WordPress EC2 instance. You will see your IP address listed in a table. Simply select the IP address row and then select ‘Associate Address’ under the ‘Actions’ button.

On the next screen, select your WordPress instance from the drop-down menu and click on the Associate button.

You will now see your Elastic IP listed in the table. Go ahead and copy the IP address and paste it into a text editor like Notepad. We will need it in the next step.

Next, you need to click on the ‘Services’ menu at the top and search for ‘Route53′. This is Amazon web services’ DNS management service that allows you to route traffic to your EC2 instance.

On the next page, click on the ‘Get Started Now’ button under the DNS management section.

This will bring you to hosted zones section. Go ahead and click on the ‘Create hosted zone’ button.

Next, you need to add your domain name and click on the create button to add it to a hosted zone.

After you have added your domain to a hosted zone, click on the ‘Create Record Set’ button. Now you need to enter www next to ‘Name’ field. Enter the elastic IP you copied earlier in the ‘Value’ field and then click on create button.

The A record will now be added to your hosted zone along with your domain name. From the left column, you need to copy the lines under NS field. These are Nameserver addresses that you will need in the next step.

Now you need to go to your domain name registrar website and edit your domain name settings. The screenshots below may vary from your provider, but the basic instructions are similar for each provider.

Under your domain’s DNS Nameservers settings, enter the nameserver addresses you copied earlier.

addnameservers21

Don’t forget to save your changes. You can now visit the domain name you added and it will take you to your WordPress site on Amazon Web Services.

Note: DNS changes may take some time to take effect.

Method 2. Using Amazon Web Services via Managed WordPress Hosting

As you may have noticed that setting up a custom WordPress install on Amazon web services is a very technical and complicated process.

The cloud computing infrastructure provided by Amazon Web Services is a pay as you go solution. This means that traffic spikes will increase your hosting bill significantly. Not to mention, that you will still be responsible for managing your own services which is just extra work.

An easier way to use WordPress on Amazon Web Services without any hassle is by using a managed WordPress hosting provider.

We recommend using WP Engine. They run part of their hosting platform on the AWS infrastructure, and you don’t have to worry about traffic spikes, server management, or WordPress maintenance.

Another great alternative is Pagely, a premium managed WordPress hosting provider. They also run their platform on Amazon Web Services and offer a hassle-free, WordPress environment to grow your business.

We hope this article helped you learn how to install WordPress on Amazon Web Services.

Easy Guide to Convert WordPress Categories to Custom Taxonomies

In this article, we will show you how to easily convert WordPress categories into custom taxonomies.

Why and When Do You Need to Convert Categories to Custom Taxonomies

Categories and tags are the two default taxonomies in WordPress. Taxonomies are used to sort and organize content into different topics.

Apart from the default taxonomies, WordPress also allows you to create custom taxonomies which you can use with existing post types or with custom post types. For more on this topic, see our article on when do you need a custom post type or taxonomy in WordPress.

As your website grow, you might find a need to convert your categories into a custom taxonomy. For example, let’s say that you have a category called topics with a lot of sub-categories. It would be time-consuming to edit each post and file it under your new custom taxonomy.

Wouldn’t it be nice if you could bulk convert some or all of your categories to the new custom taxonomy?

Let’s take a look at how you can easily convert categories to custom taxonomies without manually editing each post.

Converting WordPress Categories to Custom Taxonomies

First thing you need to do is install and activate Taxonomy Switcher plugin. For more details, see our step by step guide on how to install a WordPress plugin.

Upon activation, you need to visit Tools » Taxonomy Switcher page in your WordPress admin area to convert categories to custom taxonomies.

On this page, you can select the taxonomies you want to convert. For this tutorial, we will select ‘Categories’ as the taxonomy we want to switch from, and ‘Topics’ as the custom taxonomy we want to switch to.

If you want to convert all categories to a custom taxonomy, then you can go ahead and click on the ‘Switch Taxonomies’ button.

The plugin will convert all categories to your selected custom taxonomy. You will see a success message like this:

If you just want to convert specific categories, then you will need to add the IDs of those categories next to ‘Comma separated list of term ids to switch’field. See our article on how to find category IDs in WordPress for more details.

Additionally, if you want to skip child categories of a specific category, then you can add the IDs of the parent category next to ‘Limit taxonomy switch for child terms of a specific parent’ option.

Don’t forget to click on the ‘Switch Taxonomy’ button to save your changes.

Setting Up Redirects from Category to Custom Taxonomy

After you switch categories to a custom taxonomy, the category archive page will now show a 404 error page. This is nothing to be worried about if your website is not live yet.

However if your website is live, then search engines may have already crawled your category pages and indexed them. This means that those pages can appear in search results and users coming from search engines will see a 404 error page.

To fix this, you need to redirect users to the new taxonomy page for each category.

Luckily, there is an easy fix for that.

First, you will need to install and activate the Redirection plugin. For more details, see our step by step guide on how to install a WordPress plugin.

Upon activation, you need to visit Tools » Redirection page. In the Source URL field, you need to enter /category/.* and in the Target URL field you need to enter your custom taxonomy slug, e.g. /topic/$1

Next, you need check the box next to ‘Regex’ option, and then click on ‘Add Redirect’ button.

This redirect will now send all category archive traffic to your custom taxonomy. Only use this, if you don’t want to use categories at all.

If you want to redirect individual categories to a custom taxonomy page, then see our beginner’s guide on setting up redirects in WordPress with detailed step by step instructions.

We hope this article helped you learn how to convert WordPress categories to custom taxonomies.

Easy Guide to Add an Admin User to the WordPress Database via MySQL

In this article, we will show you a step by step guide on how to create an admin user in WordPress Database via MySQL.

Note: You should always make a backup of your database before performing any MySQL edits. This tutorial requires basic understanding of how phpMyAdmin works.

If you don’t like the video or need more instructions, then continue reading.

Step-01: you need to login to phpMyAdmin and locate your WordPress database. (Below is a screenshot of a HostGator cPanel)

Step-02: Once you are in, we will be making changes to the wp_users and wp_usermeta tables. Lets go ahead and click on wp_users table.

Step-03: We need to insert our new admin user’s information, so click on the Insert tab like it shows in the image above. In the insert form, add the following:

  • ID – pick a number (in our example, we will use the number 4).
  • user_login – insert the username you want to use to access the WordPress Dashboard.
  • user_pass – add a password for this username. Make sure to select MD5 in the functions menu (Refer to the screenshot below).
  • user_nicename – put a nickname or something else that you would like to refer yourself as.
  • user_email – add the email you want to associate with this account.
  • user_url – this would be the url to your website.
  • user_registered – select the date/time for when this user is registered.
  • user_status – set this to 0.
  • display_name – put the name you like to display for this user on the site (it can be your user_nicename value as well).
  • Click on the Go Button

Step-04: we are going to have to add the values to wp_usermeta table. Click on the wp_usermeta table and then click on the Insert tab just like the previous step. Then add the following information to the insert form:

  • unmeta_id – leave this blank (it will be auto-generated)
  • user_id – this will be the id of the user you created in the previous step. Remember we picked 4.
  • meta_key – this should be wp_capabilities
  • meta_value – insert this: a:1:{s:13:"administrator";s:1:"1";}

Insert another row with the following information:

  • unmeta_id – leave this blank (it will be auto-generated)
  • user_id – this will be the id of the user you created in the previous step. Remember we picked 4.
  • meta_key – this should be wp_user_level
  • meta_value – 10

Then click on the Go button, and you have created yourself a new username. Now you should be able to login to your wp-admin with the username and password you specified for this user. Once logged in, click on Users and edit the username you just created. Go down and click on the Save button (you don’t have to change anything). This will allow WordPress to go through and add some more information and clean-up the user we just added.

SQL query

For developers who want to speed this process up, you can simply drop this SQL query in your database.

1
2
3
4
5
6
7
INSERT INTO `databasename`.`wp_users` (`ID`, `user_login`, `user_pass`, `user_nicename`, `user_email`, `user_url`, `user_registered`, `user_activation_key`, `user_status`, `display_name`) VALUES ('4', 'demo', MD5('demo'), 'Your Name', '[email protected]', 'http://www.test.com/', '2011-06-07 00:00:00', '', '0', 'Your Name');
INSERT INTO `databasename`.`wp_usermeta` (`umeta_id`, `user_id`, `meta_key`, `meta_value`) VALUES (NULL, '4', 'wp_capabilities', 'a:1:{s:13:"administrator";s:1:"1";}');
INSERT INTO `databasename`.`wp_usermeta` (`umeta_id`, `user_id`, `meta_key`, `meta_value`) VALUES (NULL, '4', 'wp_user_level', '10');

Remember to change the databasename to the database you are working with. Also don’t forget to change the appropriate values.

Easy Guide to Use FOMO on Your WordPress Site to Increase Conversions

In this article, we will show you how to properly add FOMO to your WordPress website and boost conversions.

 

What is FOMO and How it Helps with Conversions?

FOMO or ‘fear of missing out’ is a psychological term used to describe anxiety about missing out on something exciting and trendy.

As a website owner, you can take advantage of this human behavior with your marketing strategy and improve your conversions.

FOMO is nothing new, marketers have been using it way before the arrival of the internet. Now with online marketing, FOMO has become far easier to implement and much more effective.

For example, if you run an online store, then you can create anticipation about an upcoming sale, limited time offers, and by adding social proof to your landing pages.

You can also use it to build your email list, run affiliate marketing campaigns, boost downloads for your apps, and more.

That being said, let’s take a look at how to easily add FOMO to your WordPress site. We will show you two techniques that we have successfully used on our own sites with incredible results.

1. Adding FOMO with Social Proof by Using Proven

One way to ignite FOMO is by adding social proof to your website. It helps you instantly win user’s trust by showing them that other users are already buying your product.

 

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

Proven is a social proof plugin that integrates with your eCommerce platformor MailChimp email lists and displays recent purchases and sign ups.

Upon activation, you need to head over to Proven » Settings page to enter your license key. You can find this information from your account on the plugin website.

Next, let’s head on over to the Proven » Add New page to create your first social proof notification.

First, you need to enter a title for this notification campaign. After that, you need to choose whether you want this configuration to be active or not. You can keep it inactive while you configure your settings, but don’t forget to change this setting to make your notifications live once you are done.

Next, you will come to the content section where you will be asked to select the source for your notifications.

Proven integrates with WooCommerce, MailChimp, and Easy Digital Downloads. When you integrate with one of these three, the social notification will automatically display the recent purchase and subscriber notifications.

You can also enter the source manually, which will allow you to manually create entries that will be displayed in the notification. This is particularly helpful when you are not using a shopping cart plugin on your website.

After that, you can change the content template using the available template tags displayed below the field.

For the purchases field, you need to select which product purchases are displayed in the notification. If you are integrating it with MailChimp, then you can choose which mailing list will trigger the notification.

Next, you can select when you want notifications to be displayed in the Behavior settings. You can select pages where you want the notification to appear, you can also select users, mobile view, the delay between notifications, and more.

Lastly, you will reach the ‘Appearance’ section. From here you can select colors, shape, and position of your notification banner.

Once you are satisfied with the settings, don’t forget to click on the ‘Publish’ button to make it live.

You can now visit your website to see the FOMO social proof notification in action.

Method 2: Adding FOMO Countdown Timers with OptinMonster

We have all seen marketers using ‘Urgency’ to get customer’s attention. Whether it is your local grocery store or a big name brand website, it is one of the oldest marketing techniques, which works just as effectively online.

Basically, you show users an offer with a sense of urgency, which triggers the fear of missing out a valuable deal and helps users make a purchasing decision.

Urgency hacks can be used with limited time offer, seasonal sale campaigns, one-time discounts, coupons, and more. To learn more, see this article on using urgency to hack conversion rates with proven methods.

Now, the thing is how do you use urgency with FOMO to create a powerful conversion magnet?

This is where OptinMonster comes in. It is the best conversion optimization software that helps businesses turn abandoning website visitors into subscribers & customers.

First, you will need to sign up for an OptinMonster account. It is a paid tool and you will need at least the ‘Plus’ plan to use their Floating bar campaigns.

Next, switch to your WordPress site to install and activate the OptinMonsterplugin. For more details, see our step by step guide on how to install a WordPress plugin.

This plugin is a connector between your WordPress site and the OptinMonster app.

Upon activation, click on the OptinMonster menu in your admin sidebar and enter your API key. You can find this information under your account on OptinMonster website.

After entering your API Key, you will need to click on the ‘Create New Campaign’ button to continue.

First, you need to select an optin type and then select a theme. We will be using a ‘Floating bar’ campaign with the ‘Countdown’ theme.

Next, you will be asked to choose a name for your theme and the website where you will run it. Filling this information will launch the OptinMonster Builder interface.

You need to click on the ‘Optin’ tab and select your countdown type and end date. There are two types of countdown timers you can use ‘Static’ and ‘Dynamic’.

The static timer remains the same for all your users, while the Dynamic timer changes based on user behavior on your website.

For this tutorial, we will be using the static timer. Since we are using floating bar with countdown theme, we can move the optin bar to the bottom or the top.

 

Now, go back to your WordPress website and click on the ‘Campaigns’ tab on the OptinMonster page. You will see your recently created campaign listed there (Click on refresh campaigns button if you don’t see it).

By default your campaign will be disabled, and you just have to click on the ‘Go Live’ link to enable it.

You can now visit your website to see your countdown timer FOMO campaign in action.

Tracking Your Conversions in WordPress

FOMO techniques work really well for conversions, but how do you keep track of their performance? Without tracking you wouldn’t know how many sales or leads were generated due to these campaigns.

All expert marketers use Google Analytics. It not only helps you see where your users are coming from, it also allows you to track user engagement on your website.

The easiest way to use Google Analytics in WordPress is through MonsterInsights. It is the best Google Analytics plugin for WordPress and has an eCommerce addon for WooCommerce and EDD, which helps you track your eCommerce performance without leaving WordPress.

We hope this article helped you learn how to add FOMO to your WordPress website and boost conversions. You may also want to see our list of must-have WordPress plugins for business websites.

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.

Easy Guide to Set, Get, and Delete WordPress Cookies

In this ultimate guide, we will show you how to set, get, and delete WordPress cookies.

 

Editors Note: This is an advanced tutorial. It requires you to have proficient understanding of HTML, CSS, WordPress site, and PHP.

What Are Cookies?

Cookies are plain text files that are created and stored in users browser when they visit a website. Cookies are used to add different features on a website.

Following are some of the common usage of cookies on various websites.

  • Store and manage user’s login information
  • Store temporary session information during a users visit
  • Ecommerce stores use cookies to remember cart items during a user’s visit
  • Track user activity on a site to offer personalized user experience
  • and more

As you can see, cookies are highly useful tool for website owners, but they can also be a bit invasive. Recent trends in email marketing, growth hacking, and online marketing as a whole allow websites to set cookies that act as a beacon and can be used to store and even share user activity across websites.

This is why European Union enacted the EU Cookie Law, which requires website owners to declare that they use cookies to store information.

How Cookies are Used in a Typical WordPress Website

By default, WordPress uses cookies to manage logged-in user sessions and authentication. It also uses cookies to remember a user’s name and email address if they fill out a comment form.

However, many WordPress plugins on your website may also set their own cookies.

If you are using third party services on your website like Google Analytics or Google AdSense, then they may also set cookies on your website.

You can view all website cookies in your browser’s settings. For example, in Google Chrome you need to go to settings and search for ‘content settings’.

Content settings in Google Chrome

Under content settings, you will need to click on ‘Cookies’ to open the cookies settings page.

Next, you need to click on the ‘All cookies and site data’ option.

On the next page, you will see a list of all cookies and site data stored on your browser by all websites you visited.

You can type a website address in the search box, and it will show you the data stored by that website.

Clicking on a single item will show you more details about individual cookies and their contents.

How to Set a Cookie in WordPress

To follow this tutorial, you will need to add code to your theme’s functions.phpfile or a site-specific plugin. If you haven’t done this before, then please take a look at our guide on how to copy and paste code snippets in WordPress.

First we will use the setcookie() function in PHP. This function accepts the following parameters.

  • Cookie name
  • Cookie value
  • Expire (Optional: sets a time period after which cookie expires)
  • Path (Optional, by default it will use the site’s root)
  • Domain (Optional, by default uses your website’s domain)
  • Secure (Optional, If true then only transfers cookie data via HTTPS)
  • httponly (Optional, when set true the cookie is only accessible via HTTP and cannot be used by scripts)

Now let’s add a code snippet to your WordPress site. This code stores the exact timestamp when a user visited your website in a cookie.

function wpb_cookies_tutorial1() { 
 
$visit_time = date('F j, Y  g:i a');
 
if(!isset($_COOKIE[$wpb_visit_time])) {
 
// set a cookie for 1 year
setcookie('wpb_visit_time', $current_time, time()+31556926);
 
}
 
} 

You can now visit your website and then check your browser cookies. You will find a cookie with the name wpb_visit_time.

How to Get a Cookie and Use it in WordPress

Now that we have created this cookie that’s stored in user’s browser for 1 year, let’s take a look at how can we use this information on our website.

If you know the name of a cookie, then you can easily call it anywhere in PHP using the $_COOKIE[] variable. Let’s add some code that not only sets the cookie but also uses it to do something on your website.

function wpb_cookies_tutorial2() { 
// Time of user's visit
$visit_time = date('F j, Y g:i a');
 
// Check if cookie is already set
if(isset($_COOKIE['wpb_visit_time'])) {
 
// Do this if cookie is set 
function visitor_greeting() {
 
// Use information stored in the cookie 
$lastvisit = $_COOKIE['wpb_visit_time'];
 
$string .= 'You last visited our website '. $lastvisit .'. Check out whats new'; 
 
return $string;
}   
 
} else { 
 
// Do this if the cookie doesn't exist
function visitor_greeting() { 
$string .= 'New here? Check out these resources...' ;
return $string;
}   
 
// Set the cookie
setcookie('wpb_visit_time',  $visit_time, time()+31556926);
}
 
// Add a shortcode 
add_shortcode('greet_me', 'visitor_greeting');
 
} 
add_action('init', 'wpb_cookies_tutorial2');

We have commented the code to show you what each part does. This code uses the information stored in the cookie and outputs it using the shortcode. You can now add shortcode [greet_me] anywhere on your website, and it will show when a user last visited.

Feel free to modify the code to make it more useful for your website. For example, you can show recent posts to returning users and popular posts to new users.

Deleting a Cookie in WordPress

So far we have learned how to set a cookie and use it later in your website. Now let’s take a look at how to delete a cookie.

To delete a cookie, you need to add the following line to your code.

unset($_COOKIE['wpb_visit_time']);

Don’t forget to replace wpb_visit_time with the name of the cookie you are trying to delete.

Let’s put this code in some context using the same sample code we used above. This time we will delete a cookie and set it again with new information.

function wpb_cookies_tutorial2() { 
// Time of user's visit
$visit_time = date('F j, Y g:i a');
 
// Check if cookie is already set
if(isset($_COOKIE['wpb_visit_time'])) {
 
// Do this if cookie is set 
function visitor_greeting() {
 
// Use information stored in the cookie 
$lastvisit = $_COOKIE['wpb_visit_time'];
 
$string .= 'You last visited our website '. $lastvisit .'. Check out whats new'; 
 
// Delete the old cookie so that we can set it again with updated time
unset($_COOKIE['wpb_visit_time']); 
 
return $string;
}   
 
} else { 
// Do this if the cookie doesn't exist
function visitor_greeting() { 
$string .= 'New here? Check out these resources...' ;
return $string;
}   
}
add_shortcode('greet_me', 'visitor_greeting');
 
// Set or Reset the cookie
setcookie('wpb_visit_time',  $visit_time, time()+31556926);
} 
add_action('init', 'wpb_cookies_tutorial2');

As you can see, this code deletes the cookie once we have used the information stored inside. Later we set the cookie again with the updated time information.

We hope this article helped you learn how to easily set, get, and delete WordPress cookies.