How to Fix Secure Connection Error in WordPress

Are you seeing ‘Unable to establish secure connection error’ in WordPress? It is a common WordPress error and usually occurs when you are trying to install or update a WordPress plugin or theme from official WordPress.org directory. In this article, we will show you why… Read More »

The post How to Fix Secure Connection Error in WordPress appeared first on WPBeginner.

Are you seeing ‘Unable to establish secure connection error’ in WordPress? It is a common WordPress error and usually occurs when you are trying to install or update a WordPress plugin or theme from official WordPress.org directory. In this article, we will show you why this error occurs and how to easily fix secure connection error in WordPress.

Fixing secure connection error in WordPress

What Causes Unable to Establish Secure Connection Error in WordPress?

WordPress comes with a built-in system to manage updates. This system regularly checks for updates and show notifications for you to install plugin / theme updates.

However, it needs to connect to the WordPress.org website in order to check for updates or install them. Due to some misconfiguration on your WordPress hosting server, your website may fail to connect with WordPress.org website.

This will result in a secure connection error, and you will see an error message like this:

An unexpected error occurred. Something may be wrong with WordPress.org or this server’s configuration. If you continue to have problems, please try the support forums. (WordPress could not establish a secure connection to WordPress.org. Please contact your server administrator.) in /home/username/public_html/wp-admin/includes/update.php on line 122

Secure connection error in WordPress

That being said, let’s see how to easily fix secure connection error in WordPress.

Fixing Secure Connection Error in WordPress

There are multiple ways to fix the unexpected secure connection error in WordPress. You can try one of the following solutions based on your situation.

Hosting and Server Related Issues

If your shared hosting server is under DDoS attack, then it is likely that the connection to WordPress.org will timeout causing the secure connection error.

In that case, you can wait for a few minutes and try again. If the error persists, then you need to reach out to your web hosting company’s support team.

Cloud or VPS Server Connectivity Issue

If you are on a cloud or VPS hosting, then it is possible that your server is unable to connect to WordPress.org due to some DNS issues.

In that case, you can point your server directly to WordPress.org servers. You will need to connect to your server using SSH.

SSH is short for secure shell which is an encrypted protocol that allows you to connect to your server using command line tools.

Windows users can use a tool called PuTTy whereas Mac / Linux users can use the terminal app.

You will need login credentials for the account with shell access to your hosting account. You can get this information from your hosting account’s cPanel dashboard or ask your web hosting server provider.

In the terminal, you can connect to your server like this:

ssh [email protected]

Don’t forget to replace username with your own username and example.com with your own domain name.

Once connected, you need to run the following command:

sudo nano /etc/hosts

This will open a file, and you will need to add the following code at the bottom of the file:

66.155.40.202 api.wordpress.org

You can now save your changes and exit the the editor. Visit your website to see if this resolved the error.

Fixing WordPress Secure Connection Error on Localhost

If you are running WordPress on your own computer (localhost), then you may not have cURL extension enabled for PHP. This extension is required to access WordPress.org for updates.

You will need to edit the php.ini file on your computer. This file is usually located in the PHP folder of your Mamp, Xampp, or WAMP folder.

If you are on a Windows computer, then look for the following line:

;extension=php_curl.dll

Mac and Linux users would have to look for this line:

;extension=curl.so

Now you need to remove the semicolon before the text to enable the extension. Don’t forget to save your php.ini file.

Lastly, don’t forget to restart the Apache server for changes to take affect.

Check Open Ports in Firewall

If cURL extension is properly installed on your local server, then the next step is to check your internet connection firewall.

Your computer’s firewall may be blocking outgoing connections from local server to WordPress.org. If you are on Windows, then press the start button and search for Windows Firewall. Mac users can find firewall settings in System Preferences » Security & Privacy

You need to add Apache to your firewall’s allowed programs and allow both incoming and outgoing connections.

Firewall Apache

You will need to restart Apache for changes to take effect.

We hope this article helped you solve the WordPress secure connection error. You may also want to see our ultimate step by step WordPress security guide for beginners.

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 Fix Secure Connection Error in WordPress appeared first on WPBeginner.

How to Fix Secure Connection Error in WordPress

Are you seeing ‘Unable to establish secure connection error’ in WordPress? It is a common WordPress error and usually occurs when you are trying to install or update a WordPress plugin or theme from official WordPress.org directory. In this article, we will show you why… Read More »

The post How to Fix Secure Connection Error in WordPress appeared first on WPBeginner.

Are you seeing ‘Unable to establish secure connection error’ in WordPress? It is a common WordPress error and usually occurs when you are trying to install or update a WordPress plugin or theme from official WordPress.org directory. In this article, we will show you why this error occurs and how to easily fix secure connection error in WordPress.

Fixing secure connection error in WordPress

What Causes Unable to Establish Secure Connection Error in WordPress?

WordPress comes with a built-in system to manage updates. This system regularly checks for updates and show notifications for you to install plugin / theme updates.

However, it needs to connect to the WordPress.org website in order to check for updates or install them. Due to some misconfiguration on your WordPress hosting server, your website may fail to connect with WordPress.org website.

This will result in a secure connection error, and you will see an error message like this:

An unexpected error occurred. Something may be wrong with WordPress.org or this server’s configuration. If you continue to have problems, please try the support forums. (WordPress could not establish a secure connection to WordPress.org. Please contact your server administrator.) in /home/username/public_html/wp-admin/includes/update.php on line 122

Secure connection error in WordPress

That being said, let’s see how to easily fix secure connection error in WordPress.

Fixing Secure Connection Error in WordPress

There are multiple ways to fix the unexpected secure connection error in WordPress. You can try one of the following solutions based on your situation.

Hosting and Server Related Issues

If your shared hosting server is under DDoS attack, then it is likely that the connection to WordPress.org will timeout causing the secure connection error.

In that case, you can wait for a few minutes and try again. If the error persists, then you need to reach out to your web hosting company’s support team.

Cloud or VPS Server Connectivity Issue

If you are on a cloud or VPS hosting, then it is possible that your server is unable to connect to WordPress.org due to some DNS issues.

In that case, you can point your server directly to WordPress.org servers. You will need to connect to your server using SSH.

SSH is short for secure shell which is an encrypted protocol that allows you to connect to your server using command line tools.

Windows users can use a tool called PuTTy whereas Mac / Linux users can use the terminal app.

You will need login credentials for the account with shell access to your hosting account. You can get this information from your hosting account’s cPanel dashboard or ask your web hosting server provider.

In the terminal, you can connect to your server like this:

ssh [email protected]

Don’t forget to replace username with your own username and example.com with your own domain name.

Once connected, you need to run the following command:

sudo nano /etc/hosts

This will open a file, and you will need to add the following code at the bottom of the file:

66.155.40.202 api.wordpress.org

You can now save your changes and exit the the editor. Visit your website to see if this resolved the error.

Fixing WordPress Secure Connection Error on Localhost

If you are running WordPress on your own computer (localhost), then you may not have cURL extension enabled for PHP. This extension is required to access WordPress.org for updates.

You will need to edit the php.ini file on your computer. This file is usually located in the PHP folder of your Mamp, Xampp, or WAMP folder.

If you are on a Windows computer, then look for the following line:

;extension=php_curl.dll

Mac and Linux users would have to look for this line:

;extension=curl.so

Now you need to remove the semicolon before the text to enable the extension. Don’t forget to save your php.ini file.

Lastly, don’t forget to restart the Apache server for changes to take affect.

Check Open Ports in Firewall

If cURL extension is properly installed on your local server, then the next step is to check your internet connection firewall.

Your computer’s firewall may be blocking outgoing connections from local server to WordPress.org. If you are on Windows, then press the start button and search for Windows Firewall. Mac users can find firewall settings in System Preferences » Security & Privacy

You need to add Apache to your firewall’s allowed programs and allow both incoming and outgoing connections.

Firewall Apache

You will need to restart Apache for changes to take effect.

We hope this article helped you solve the WordPress secure connection error. You may also want to see our ultimate step by step WordPress security guide for beginners.

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 Fix Secure Connection Error in WordPress appeared first on WPBeginner.

How to Remove v=XXXX string from WordPress URLs

Are you seeing strange v=xxxx string in your WordPress URLs? Recently, one of our readers asked us how to get rid of v=xxxx string from their WordPress URLs. This string is made up of seemingly random letter and numbers added as a parameter to your… Read More »

The post How to Remove v=XXXX string from WordPress URLs appeared first on WPBeginner.

Are you seeing strange v=xxxx string in your WordPress URLs? Recently, one of our readers asked us how to get rid of v=xxxx string from their WordPress URLs. This string is made up of seemingly random letter and numbers added as a parameter to your permalinks. In this article, we will show you how to easily remove v=xxxx string from your WordPress URLs.

How to Remove v=xxxx string from WordPress URLs

Why Are You Seeing v=XXXX String in Your WordPress URLs?

This string appears on websites running an online store using WooCommerce. It is not a bug or an error, but an actual feature of the plugin.

String with letters and numbers added to WordPress URLs by WooCommerce

The purpose of this string is to help WooCommerce calculate tax and shipping based on a user’s geographic location. The string helps make the feature compatible with WordPress caching plugins like WP Super Cache or W3 Total Cache.

However, if you don’t need to calculate shipping and taxes based on different locations, then you probably accidentally enabled this feature.

Let’s take a look at how to easily disable it and remove the random v=xxxxxx strings from your WordPress URLs.

Removing v=xxxx String from WordPress URLs

First you need to login to your WordPress admin area and head over to the WooCommerce » Settings page.

Under the General tab, you need to scroll down to ‘Default customer location’ option.

Disable Geolocation

It would be set to ‘Geolocate (with page caching support)’. You need to change it to either ‘No location by default’ or ‘Shop base address’.

Don’t forget to click on the save changes button to store your settings.

If you are using a caching plugin, then you will need to clear your WordPress cache. After that you can visit your website, and the geolocation string will disappear from your WordPress URLs.

Ù�

How to GeoLocate Default Location Without the URL String?

You can do that by selecting the ‘Geolocate’ option in the ‘Default customer location’ setting.

Geolocate without caching

However, this option is not compatible with static caching plugins, and it will show incorrect shipping and tax information to users due to previously cached page.

Running WooCommerce without caching is not recommended because it will slow down your site’s speed and performance.

If you must use Geolocate to calculate shipping and taxes on the fly, then for the time being you will have to tolerate the ugly v=xxxx string in your WordPress URLs.

We hope this article helped you learn how to remove v=xxxx string from your WordPress URLs. You may also want to see our ultimate list of the most common WordPress errors and how to fix them.

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 Remove v=XXXX string from WordPress URLs appeared first on WPBeginner.

How to Properly Add JavaScripts and Styles in WordPress

Do you want to learn how to properly add JavaScripts and CSS stylesheets in WordPress? Many DIY users often make the mistake of directly calling their scripts and stylesheets in plugins and themes. In this article, we will show you how to properly add JavaScripts… Read More »

The post How to Properly Add JavaScripts and Styles in WordPress appeared first on WPBeginner.

Do you want to learn how to properly add JavaScripts and CSS stylesheets in WordPress? Many DIY users often make the mistake of directly calling their scripts and stylesheets in plugins and themes. In this article, we will show you how to properly add JavaScripts and stylesheet in WordPress. This will be particularly useful for those who are just starting to learn WordPress theme and plugin development.

Properly adding JavaScripts and styles in WordPress

Common Mistake When Adding Scripts and Stylesheets in WordPress

Many new WordPress plugins and theme developers make the mistake of directly adding their scripts or inline CSS into their plugins and themes.

Some mistakenly use the wp_head function to load their scripts and stylesheets.

<?php
add_action('wp_head', 'wpb_bad_script');
function wpb_bad_script() {
echo 'jQuery goes here';
}
?>

While the above code may seem easier, it is the wrong way of adding scripts in WordPress, and it leads to more conflicts in the future.

For example, if you load jQuery manually and another plugin loads jQuery through the proper method, then you have jQuery being loaded twice. If it is loaded on every page, then this will negatively affect WordPress speed and performance.

It is also possible that the two are different versions which can also cause conflicts.

That being said, let’s take a look at the right way of adding scripts and stylesheets.

Why Enqueue Scripts and Styles in WordPress?

WordPress has a strong developer community. Thousands of people from around the world develop themes and plugins for WordPress.

To make sure that everything works properly, and no one is stepping on another’s toes, WordPress has an enqueuing system. This system provides a programmable way of loading JavaScripts and CSS stylesheets.

By using wp_enqueue_script and wp_enqueue_style functions, you tell WordPress when to load a file, where to load it, and what are its dependencies.

This system also allow developers to utilize the built-in JavaScript libraries that come bundled with WordPress rather than loading the same third-party script multiple times. This reduces page load time and helps avoid conflicts with other themes and plugins.

How to Properly Enqueue Scripts in WordPress?

Loading scripts properly in WordPress is very easy. Below is an example code that you would paste in your plugins file or in your theme’s functions.php file to properly load scripts in WordPress.

?php
function wpb_adding_scripts() {

wp_register_script('my_amazing_script', plugins_url('amazing_script.js', __FILE__), array('jquery'),'1.1', true);

wp_enqueue_script('my_amazing_script');
}
 
add_action( 'wp_enqueue_scripts', 'wpb_adding_scripts' );  
?>

Explanation:

We started by registering our script through the wp_register_script() function. This function accepts 5 parameters:

  • $handle – Handle is the unique name of your script. Ours is called “my_amazing_script”
  • $src – src is the location of your script. We are using the plugins_url function to get the proper URL of our plugins folder. Once WordPress finds that, then it will look for our filename amazing_script.js in that folder.
  • $deps – deps is for dependency. Since our script uses jQuery, we have added jQuery in the dependency area. WordPress will automatically load jQuery if it is not being loaded already on the site.
  • $ver – This is the version number of our script. This parameter is not required.
  • $in_footer – We want to load our script in the footer, so we have set the value to be true. If you want to load the script in the header, then you would make it false.

After providing all the parameters in wp_register_script, we can just call the script in wp_enqueue_script() which makes everything happen.

The last step is to use wp_enqueue_scripts action hook to actually load the script. Since this is an example code, we have added that right below everything else.

If you were adding this to your theme or plugin, then you can place this action hook where the script is actually required. This allows you to reduce the memory footprint of your plugin.

Now some might wonder why are we going the extra step to register the script first and then enqueuing it? Well, this allows other site owners to deregister your script without modifying the core code of your plugin.

Properly Enqueue Styles in WordPress

Just like scripts, you can also enqueue your stylesheets. Look at the example below:

<?php
function wpb_adding_styles() {
wp_register_style('my_stylesheet', plugins_url('my-stylesheet.css', __FILE__));
wp_enqueue_style('my_stylesheet');
}
add_action( 'wp_enqueue_scripts', 'wpb_adding_styles' );  
?>

Instead of using wp_enqueue_script, we are now using wp_enqueue_style to add our stylesheet.

Notice that we have used wp_enqueue_scripts action hook for both styles and scripts. Despite the name, this function works for both.

In the examples above, we have used plugins_url function to point to the location of the script or style we wanted to enqueue.

However, if you are using the enqueue scripts function in your theme, then simply use get_template_directory_uri() instead. If you are working with a child theme, then use get_stylesheet_directory_uri().

Below is an example code:

<?php
 
function wpb_adding_scripts() {
wp_register_script('my_amazing_script', get_template_directory_uri() . '/js/amazing_script.js', array('jquery'),'1.1', true);
wp_enqueue_script('my_amazing_script');
}
 
add_action( 'wp_enqueue_scripts', 'wpb_adding_scripts' );  
?>

We hope this article helped you learn how to properly add jacvascript and styles in WordPress. You may also want to study the source code of the top WordPress plugins for some real life code examples.

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 Properly Add JavaScripts and Styles in WordPress appeared first on WPBeginner.

How to Track User Engagement in WordPress with Google Analytics

Are you properly tracking user engagement on your WordPress site? User engagement is one of the most important metric to track because it helps you strategically plan for growth. In this article, we will show you how to track user engagement in WordPress with Google… Read More »

The post How to Track User Engagement in WordPress with Google Analytics appeared first on WPBeginner.

Are you properly tracking user engagement on your WordPress site? User engagement is one of the most important metric to track because it helps you strategically plan for growth. In this article, we will show you how to track user engagement in WordPress with Google Analytics.

Tracking User Engagement

Why Track User Engagement with Google Analytics

Generally, website owners consider traffic and pageviews as the most important indicators of their website’s performance. They assume that higher traffic will result into more conversions and sales.

While that is true, you can get even better results by tracking and optimizing user engagement.

User engagement shows you what users do when they arrive on your website. It helps you identify patterns of highly engaged user behavior which leads to more conversions and sales.

For example, you may realize that users visiting a specific page are 10X more likely to make a purchase vs any other visitor on your website. You can use this insight to redirect more user’s attention to that page.

To track user engagement on our websites, we use Google Analytics in combination with the popular MonsterInsights plugin.

If you haven’t already signed up for Google Analytics, then you can follow the instructions in our guide on how to install Google Analytics in WordPress.

Next, you need to install and activate the MonsterInsights plugin. We recommend getting the Pro plan of this plugin.

Now most people ask us why install a plugin, when you can just paste the Google Analytics script in the footer of the website.

The reason is that by simply pasting a link in the footer, you miss out on key user engagement data. You won’t know which outbound links are users clicking, which forms have the highest conversions, which products in your online store has the best conversions, which affiliate links or ads are getting the most clicks, etc.

MonsterInsights plugin automatically handles all of that and more for you. It automates the process of pasting different analytics code and event tracking scripts in the footer, so you don’t have to deal with the hassle of code and configuration.

Once you have setup Google Analytics with MonsterInsights, let’s take a look at how to track different user engagement metrics for your site.

1. Tracking Your Most Popular Content

The first thing you want to figure out is which blog posts and pages are the most popular amongst your users? These are the pages and posts on your website getting the most traffic.

Figuring out what your users like on your site can help you plan a content strategy that expands on what’s already working.

MonsterInsights makes it really simple. You just need to visit Insights » Reports page in your WordPress admin area.

You will find your most popular content under the ‘Top posts and pages’ section.

Most popular content

Next to it, you’ll also see your top traffic sources. This gives you a general idea of where your traffic is coming from.

On most websites, 90% of their traffic goes to 10% of the top pages. Once you find these top pages, you can optimize them for maximum conversions by adding content upgrades or targeted lead magnets on these posts.

We find that by adding content upgrades can help you boost your conversions by as high as 845%. Our founder Syed Balkhi has a blog post sharing the case study results.

2. Tracking How Users Engage with Forms on Your Website

Most websites rely on contact forms to collect user leads and feedback. Sadly most contact form plugins don’t give you accurate tracking and conversions data.

MonsterInsights lets you leverage Google Analytics’ events tracking feature to see how many times your forms are viewed and submitted.

To enable forms tracking, you need to visit Insights » Addons page. On this page, you will need to install and activate the Forms addon.

Install Forms Addon for MonsterInsights

Once you have activated the Forms addon, MonsterInsights will automatically start tracking all forms on your website.

It automatically works with popular contact form plugins like WPForms, Ninja Forms, Formidable, and others. MonsterInsights also track your website comment form, user registration forms, and more.

To see how your forms are doing, you will need to visit your Google Analytics account. In the Google Analytics dashboard, click on Behavior » Events » Overview page and then under ‘Event Category’ click on ‘form’.

Form tracking in Google Analytics

Next, you need to click on the ‘Event Label’ to see stats for different forms on your website.

Sort by form label

From there, you can click on any form to see your impressions and conversions.

Form impressions and conversions

3. Tracking Ecommerce Stores in Google Analytics

Google Analytics offer many features specifically for eCommerce websites. However these features are not turned on by default, and most users don’t even know that they exist.

Enhanced Ecommerce tracking lets you see shopping behavior, checkout behavior, product lists performance, sales performance, and so much more. The best part is that you can combine this data with your overall website traffic to gather better insights.

MonsterInsights eCommerce tracking for WordPress works with both WooCommerce and Easy Digital Downloads.

First, you will need to enable eCommerce tracking in Google Analytics. Head over to your Google Analytics account and switch to the admin page.

Google Analytics admin

Next, you need to click on the ‘Ecommerce Settings’.

Ecommerce settings

Now click the slider under the first step, Enable Ecommerce, to turn it on. You need to click on the Next Step button to continue.

Enable eCommerce tracking

We also recommend that you turn on the Enhanced Ecommerce settings.

Enhanced ecommerce

Once you are done, click on the submit button to store your settings.

Next, you need to switch to your WordPress admin area. Go to Insights » Addons page and install and activate the ‘Ecommerce Addon’.

MonsterInsights ecommerce addon

After that you can head over to Insights » Settings page and click on the tracking tab. Next, click on the Ecommerce section to continue.

Enhanced eCommerce tracking

On this tab, you need to check the box next to ‘Use Enhanced eCommerce’ and then click on ‘Save changes’ button to store your settings.

To view your ecommerce tracking reports, you need to visit your Google Analytics account and go to Conversions » Ecommerce page.

Ecommerce tracking

Here are a few powerful reports you get by enabling Enhanced eCommerce tracking on your store:

  • Shopping Behavior
  • Checkout Behavior
  • Product Lists Performance
  • Sales Performance

For more details on each of these reports, see this article on adding Google Analytics enhanced ecommerce to your website.

4. Tracking Who’s Clicking on Your Ads with Google Analytics

Many websites rely on ads to make money online while creating useful content. Advertising platforms like Google AdSense provide you some reports on ad impressions and clicks.

However, with MonsterInsights and Google Analytics you can actually see how users interact with ads on your site. You’ll be able to:

  • Track how many clicks each ad is receiving
  • Discover which ads your audience are ignoring
  • Identify the most effective ad placements
  • And more…

First you will need to visit Insights » Addons page on your WordPress site. Now install and activate the ‘Ads Tracking’ addon.

Ads tracking addon

Next, you need to integrate Google Analytics to your Google Adsense account.

Head over to your Google Analytics dashboard and click on the ‘Admin’ button located at the bottom left corner of the screen.

Switch to the Google Analytics Admin section

On the admin page, click on ‘AdSense linking’ under the property column.

Linking AdSense

Next, you need to click the +New AdSense Link button and then select AdSense property that you want to link with your Analytics property.

Select and link AdSense property

After that, click on the continue button to move forward.

Next, you need to select the Analytics view in which you want your AdSense data to be available. Once you select that click Enable Link and then click Done.

Adsense link setup

After you have configured everything in Google Analytics, you need to head over to your WordPress site and go to Insights » Settings page. Switch to the ‘Tracking’ tab and then click on the Ads section.

You need to Enable Google Adsense tracking in MonsterInsights.

Enable Adsense tracking in Google Analytics with MonsterInsights

To view your AdSense performance reports, go to your Google Analytics account and visit Behavior » Publisher page.

Adsense reports

The overview report gives you a high-level summary of key AdSense metrics. You can also find the Publisher Pages and Publisher Referrers report in Google Analytics.

5. Tracking Your Affiliate Links in Google Analytics

Most affiliate marketers use plugins to manage and cloak affiliate links. This makes your affiliate links look more user-friendly. Here is an example of a cloaked affiliate link:

http://example.com/recommends/product-name/

MonsterInsights allows you to track those affiliate links in Google Analytics. This helps you figure out which affiliate products are doing well, which pages are generating more affiliate revenue, and more.

To enable Affiliate link tracking, you need to visit Insights » Settings page. Switch to the tracking tab and then click on ‘Affiliate links’ section.

Affiliate link tracking in MonsterInsights

First you need to enter the slug you use for your affiliate links. After that, you need to provide a label you would like to use for those links in your Google Analytics reports.

Next, click on the save changes button to store your settings.

MonsterInsights lets you track affiliate clicks as events in Google Analytics.

To find an overview of your affiliate link clicks report, you can go to Behavior » Events » Overview page. Your affiliate link clicks will be shown with the label you chose earlier.

Affiliate link reports

For more detailed instructions, see our guide on how to track outbound links in WordPress.

Note: most WordPress affiliate plugins may promise to give you link stats. We have found most of those stats to be highly inaccurate because most WordPress based analytics tracking breaks due to caching. Google Analytics is the only way to properly track analytics.

6. Tracking Bounce Rate in Google Analytics

Bounce rate is the percentage of users who land on your website and decide to leave without going to a second page.

To check your website’s bounce rate, you need to login to your Google Analytics dashboard and then go to Audience » Overview page.

Checking bounce rate in Google Analytics

Want to see an individual page’s bounce rate? Head over to Behavior » Site Content » All Pages to see all pages from your website.

Checking bounce rate for individual pages

You can sort the pages by higher or lower bounce rate to see which pages are not performing.

Higher bounce rate indicates that you were unable to convince the user to visit other pages. Users can leave your website by clicking on the back button in their browser, clicking on an outgoing link, or by closing the window.

Bounce rates are completely normal. However higher bounce rates indicate problems with your website affecting user experience and causing low conversions / engagement.

What should be the acceptable bounce rate for your website?

Here is a general breakdown of bounce rate from good to bad.

An excellent bounce rate is between 30% and 50%. However, most websites fall between 50% and 70% bounce rate which is an acceptable average. Bounce rates higher than 70% are considered poor for most websites.

Not all websites are the same which means average bounce rate vary depending on different kind of websites.

Take a look at the chart below to see an average bounce rate by industry:

Bounce rate average by industry

For more on this topic, see this article with tips to reduce bounce rate on your website.

7. Tracking Time Spent on Your Website

Another indicator that shows user engagement is session duration or time users spend on your site.

If users are abandoning your site without spending enough time to look at it, then something is wrong that needs to be fixed.

Google Analytics can show you the average time users spend on your site per session. Simply go to Audience » Overview page, and you will see it among other stats.

Average time spend per session

It can also show you how much time users spend when viewing individual pages. You can check it by visiting Behavior » Site Content » All Pages page in Google Analytics.

Time spent on individual pages

To learn how to improve session durations, take a look at this article with practical tips to increase time users spend on your website.

8. Tracking Page Views Per Visit with Google Analytics

Page views per visit is another great indicator of how engaged your users are. More page views per session also increases time users spend on your site and decreases bounce rates.

Google Analytics will show you the total page views for a given period on Audience » Overview page. However, to track user engagement you also want to see page views per session.

Tracking page views in Google Analytics

You can also break down page views per session by source and channel by visiting Acquisation » All Traffic » Channels page.

Pages per session by channel

This helps you see which traffic channels are converting the best for your website, so you can focus your efforts on areas that are actually driving results.

We hope this article helped you track user engagement in WordPress with Google Analytics. You may also want to see our ultimate step by step WordPress SEO guide and email marketing 101 guide for beginners.

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 Track User Engagement in WordPress with Google Analytics appeared first on WPBeginner.

How to Add Official LinkedIn Share Button in WordPress

Business-oriented social network LinkedIn has launched their own share button, which gives publishers a way to spread their content on LinkedIn and enables users to easily share content with their LinkedIn network. In this article, we will show you how you can quickly add the LinkedIn Share Button in WordPress.

The post How to Add Official LinkedIn Share Button in WordPress appeared first on WPBeginner.

Do you want to add the official LinkedIn share button in WordPress? There are many social media plugins that let you add share buttons, but most of them don’t use the official buttons. In this article, we will show you how to add the official LinkedIn share button in WordPress.

Adding LinkedIn share button in WordPress

Adding Official LinkedIn Share Button in WordPress

For this tutorial you’ll need to edit your WordPress theme files. If you haven’t done this before, then check out our guide on how to copy and paste code in WordPress.

First, you need to visit the LinkedIn Share Plugin page. You will be asked to select your website’s language and the button style you want to use.

You can leave the URL field blank because the share button can automatically get the page URL.

Next, you need to click on the ‘Get Code’ button to copy your LinkedIn share button code.

Copy the LinkedIn share button code

Now that we got the share code, let’s add the official buttons in your WordPress site.

Display LinkedIn Share Button in WordPress Posts and Pages

If you want to display the LinkedIn share button before your post content, then you can use the following code. You will need to copy and paste this code into your theme’s functions.php file or in a site-specific plugin.

function wpb_linkedin_share_before($content) { 
// Share code you copied from LinkedIn goes here
$sharecode .= '<script src="//platform.linkedin.com/in.js" type="text/javascript"> lang: en_US</script>
<script type="IN/Share" data-counter="top"></script>'; 
$newcontent = $sharecode .$content; 
return $newcontent; 
} 
add_filter('the_content', 'wpb_linkedin_share_before');

You can save your changes and visit your website to see it in action.

LinkedIn Share button in action

If you want to display the share button after your post’s content, then you will need to add the following code instead.

function wpb_linkedin_share_after($content) { 
$sharecode .= '<script src="//platform.linkedin.com/in.js" type="text/javascript"> lang: en_US</script>
<script type="IN/Share" data-counter="top"></script>'; 
$newcontent = $content . $sharecode; 
return $newcontent; 
} 
add_filter('the_content', 'wpb_linkedin_share_after');

You can also add the LinkedIn share button code you copied earlier directly into a WordPress custom HTML widget. Simply visit Appearance » Widgets page and add the ‘Custom HTML’ widget to a sidebar.

Next, add your LinkedIn Share button code inside the custom HTML widget and click on the save button to store your changes.

Linkedin button in a sidebar widget

You can now visit your website to see it in action.

LinkedIn share button in sidebar

We hope this article helped you learn how to easily add the official LinkedIn share button in WordPress. You may also want to see our list of the best LinkedIn plugins for 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 Add Official LinkedIn Share Button in WordPress appeared first on WPBeginner.

How to Fix Destination Folder Already Exists Error in WordPress

Are you seeing ‘Destination folder already exists’ error in WordPress? This error usually occurs during the installation of a theme or a plugin which prevents you from finishing the installation process. In this article, we will show you how to fix destination folder already exists… Read More »

The post How to Fix Destination Folder Already Exists Error in WordPress appeared first on WPBeginner.

Are you seeing ‘Destination folder already exists’ error in WordPress? This error usually occurs during the installation of a theme or a plugin which prevents you from finishing the installation process. In this article, we will show you how to fix destination folder already exists error in WordPress.

 How to Fix Destination Folder Already Exists Error in WordPress

What Causes Destination Folder Already Exists Error in WordPress?

This error occurs when you are trying to install a WordPress theme or plugin. WordPress extracts your plugin or theme’s zip file into a folder named after the file itself.

If a folder with the same name already exists, then WordPress aborts the installation with the following error message:

Destination folder already exists. /home/user/example.com/wp-content/plugins/wpforms/

Plugin install failed.

Destination folder already exists error

The first thing that you should do is visit your themes or plugins page to see if you have it already installed on your site.

If it isn’t already installed, then this could mean two things:

1. A previous attempt to delete the plugin or theme didn’t succeed, and it left the plugin / theme folder behind.

2. A previous installation attempt was interrupted and left an empty destination folder.

In either case, there is a folder with the same name as the theme or plugin you are trying to install. This folder is stopping WordPress from completing the installation.

That being said, let’s take a look at how to easily solve destination folder already exists error in WordPress.

Fixing Destination Folder Already Exists Error in WordPress

First you will need to connect to your WordPress site using an FTP client or cPanel File Manager.

Once connected, you need to go to the /wp-content/plugins/ or /wp-content/themes/ folder (depending on what you were trying to install).

Now, look for the folder named after the plugin or theme that you were trying to install and then delete it.

Delete folder

You can now go back to your WordPress admin area and retry installing the plugin or theme like you would normally do.

You should be able to install your WordPress plugin or theme without any error.

We hope this article helped you learn how to easily fix destination folder already exists error in WordPress. You may also want to see our ultimate list of the most common WordPress errors and how to fix them.

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 Fix Destination Folder Already Exists Error in WordPress appeared first on WPBeginner.

How to Properly Move WordPress From Subdomain to Root Domain

Do you want to move a WordPress site from subdomain to root domain? The process is fairly easy to follow, and there is a way to save your SEO rankings as well. In this article, we will show you how to easily move WordPress from… Read More »

The post How to Properly Move WordPress From Subdomain to Root Domain appeared first on WPBeginner.

Do you want to move a WordPress site from subdomain to root domain? The process is fairly easy to follow, and there is a way to save your SEO rankings as well. In this article, we will show you how to easily move WordPress from subdomain to root domain with step by step instructions.

Moving a WordPress site from subdomain to root domain

Transferring WordPress from Subdomain to Root Domain

A subdomain is an extension of your root domain name. For example, http://yourwebsite.example.com is a subdomain of example.com. In this case, example.com is the root domain.

Search engines consider subdomain to be a totally different website. This is why you need to make sure that you properly redirect search engines to the root domain after the transfer. This will help you preserve search rankings after moving your website.

Unlike moving a WordPress site to new host or a new domain name, moving a site to root domain is a bit easier.

Primarily because both are usually hosted with the same web hosting company. This allows you to skip a few steps.

Let’s take a look at how to move a WordPress site from subdomain to root domain.

Step 1. Create a Complete Backup of Your Website

You should always keep a backup solution installed on your website for automated backups. There are plenty of WordPress backup plugins that you can use to keep your WordPress content safe.

Now if you already have a backup plugin installed, then you may be thinking that you can skip this step.

This step is to remind you that even if you have automated backups of your website, you still need to create a complete backup of your site. This includes a database backup as well as a backup of all your WordPress files and folders.

Once you have created a complete backup, make sure that you store it on a remote location or on your computer.

Step 2. Moving Your WordPress Files From Subdomain to Root Folder

First you need to connect to your website using a FTP client or cPanel’s file manager. Once connected, go to your subfolder location and download all your WordPress files to your computer.

Download WordPress files

Next, open the public_html folder of your root domain. Depending on how your WordPress hosting environment is setup, this folder could also be named www or after your domain name.

Now, you need to upload all WordPress files you downloaded earlier to the root directory.

Upload WordPress files to root domain

Step 3. Change WordPress URL and Site URL Settings

Once you move the WordPress files, you will not be able to access the WordPress admin area on the root domain. Trying to login to the root website will send you back to the subdomain website’s admin area.

To fix this, switch to the FTP client and go to the root directory of your domain name. Next, you need to edit the wp-config.php file and add the following lines just before the line ‘That’s all, stop editing! Happy blogging’.

define('WP_HOME','http://example.com');
define('WP_SITEURL','http://example.com');

Don’t forget to replace example.com with your own domain name. If you want your root website to use www then you will need to enter the URLs with www prefix.

Save your changes and upload the wp-config.php file back to your website.

You can now visit your WordPress site’s admin area on the root domain name.

Step 4. Update URLs

Your WordPress site has moved to the root domain, but there will be links inside your WordPress database pointing to the subdomain.

Let’s fix that.

You will need to install and activate the Velvet Blues Update URLs plugin. For more details, see our step by step guide on how to install a WordPress plugin.

Upon activation, you need to visit Tools » Update URLs page.

Update URLs

On this page, you need to enter your subdomain url next to the Old URL option and add your root domain as the new URL. Next, under the ‘Choose which URLs should be updated’ area, you need to check all options except ‘All GUIDs’.

Once you are done, click on the ‘Update URLs Now’ button to continue.

The plugin will now update all URLs in your WordPress database. This may take some time. Once finished, you will see a success message.

Step 5. Redirect All Subdomain Traffic to The Root Domain

Now that you have moved WordPress files, let’s make sure that your subdomain traffic is redirected to the root domain name.

Go to your subdomain folder and make sure that hidden files are forced to be visible.

Your FTP client settings have an option to always show hidden files. In FileZilla, it is located under ‘Server > Force Showing Hidden Files’ option.

Show hidden files

If you are using cPanel File Manager, then click on the Settings button at the top right corner of the screen. This will bring up the preferences popup. You need to select ‘Show hidden files’ and then click on the save button.

Show hidden files in cPanel file manager

If your subdomain folder already has a .htaccess file, then you can delete it and create a new one. Inside the new .htaccess file, you need to copy and paste the following code:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^yoursubdomain\.example\.com$ [NC]
RewriteRule ^(.*)$ "http://example.com/$1" [R=301,L]
</IfModule>

Don’t forget to replace yoursubdomain with your actual subdomain, and example.com with your domain name.

Please note that the RewriteRule line uses a non-www URL. If you want to use www in your root domain, then you will need to add your URL with a www prefix.

Save your changes and upload your .htaccess file to the server.

That’s all, you have successfully moved your site from subdomain to root domain. You can now visit your website to see it in action. Test out your website to make sure that everything is working fine.

We hope this article helped you move your site from subdomain to root domain. You may also want to see our ultimate WordPress SEO guide for beginners.

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 Properly Move WordPress From Subdomain to Root Domain appeared first on WPBeginner.

How to Properly Move WordPress From Subdomain to Root Domain

Do you want to move a WordPress site from subdomain to root domain? The process is fairly easy to follow, and there is a way to save your SEO rankings as well. In this article, we will show you how to easily move WordPress from… Read More »

The post How to Properly Move WordPress From Subdomain to Root Domain appeared first on WPBeginner.

Do you want to move a WordPress site from subdomain to root domain? The process is fairly easy to follow, and there is a way to save your SEO rankings as well. In this article, we will show you how to easily move WordPress from subdomain to root domain with step by step instructions.

Moving a WordPress site from subdomain to root domain

Transferring WordPress from Subdomain to Root Domain

A subdomain is an extension of your root domain name. For example, http://yourwebsite.example.com is a subdomain of example.com. In this case, example.com is the root domain.

Search engines consider subdomain to be a totally different website. This is why you need to make sure that you properly redirect search engines to the root domain after the transfer. This will help you preserve search rankings after moving your website.

Unlike moving a WordPress site to new host or a new domain name, moving a site to root domain is a bit easier.

Primarily because both are usually hosted with the same web hosting company. This allows you to skip a few steps.

Let’s take a look at how to move a WordPress site from subdomain to root domain.

Step 1. Create a Complete Backup of Your Website

You should always keep a backup solution installed on your website for automated backups. There are plenty of WordPress backup plugins that you can use to keep your WordPress content safe.

Now if you already have a backup plugin installed, then you may be thinking that you can skip this step.

This step is to remind you that even if you have automated backups of your website, you still need to create a complete backup of your site. This includes a database backup as well as a backup of all your WordPress files and folders.

Once you have created a complete backup, make sure that you store it on a remote location or on your computer.

Step 2. Moving Your WordPress Files From Subdomain to Root Folder

First you need to connect to your website using a FTP client or cPanel’s file manager. Once connected, go to your subfolder location and download all your WordPress files to your computer.

Download WordPress files

Next, open the public_html folder of your root domain. Depending on how your WordPress hosting environment is setup, this folder could also be named www or after your domain name.

Now, you need to upload all WordPress files you downloaded earlier to the root directory.

Upload WordPress files to root domain

Step 3. Change WordPress URL and Site URL Settings

Once you move the WordPress files, you will not be able to access the WordPress admin area on the root domain. Trying to login to the root website will send you back to the subdomain website’s admin area.

To fix this, switch to the FTP client and go to the root directory of your domain name. Next, you need to edit the wp-config.php file and add the following lines just before the line ‘That’s all, stop editing! Happy blogging’.

define('WP_HOME','http://example.com');
define('WP_SITEURL','http://example.com');

Don’t forget to replace example.com with your own domain name. If you want your root website to use www then you will need to enter the URLs with www prefix.

Save your changes and upload the wp-config.php file back to your website.

You can now visit your WordPress site’s admin area on the root domain name.

Step 4. Update URLs

Your WordPress site has moved to the root domain, but there will be links inside your WordPress database pointing to the subdomain.

Let’s fix that.

You will need to install and activate the Velvet Blues Update URLs plugin. For more details, see our step by step guide on how to install a WordPress plugin.

Upon activation, you need to visit Tools » Update URLs page.

Update URLs

On this page, you need to enter your subdomain url next to the Old URL option and add your root domain as the new URL. Next, under the ‘Choose which URLs should be updated’ area, you need to check all options except ‘All GUIDs’.

Once you are done, click on the ‘Update URLs Now’ button to continue.

The plugin will now update all URLs in your WordPress database. This may take some time. Once finished, you will see a success message.

Step 5. Redirect All Subdomain Traffic to The Root Domain

Now that you have moved WordPress files, let’s make sure that your subdomain traffic is redirected to the root domain name.

Go to your subdomain folder and make sure that hidden files are forced to be visible.

Your FTP client settings have an option to always show hidden files. In FileZilla, it is located under ‘Server > Force Showing Hidden Files’ option.

Show hidden files

If you are using cPanel File Manager, then click on the Settings button at the top right corner of the screen. This will bring up the preferences popup. You need to select ‘Show hidden files’ and then click on the save button.

Show hidden files in cPanel file manager

If your subdomain folder already has a .htaccess file, then you can delete it and create a new one. Inside the new .htaccess file, you need to copy and paste the following code:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^yoursubdomain\.example\.com$ [NC]
RewriteRule ^(.*)$ "http://example.com/$1" [R=301,L]
</IfModule>

Don’t forget to replace yoursubdomain with your actual subdomain, and example.com with your domain name.

Please note that the RewriteRule line uses a non-www URL. If you want to use www in your root domain, then you will need to add your URL with a www prefix.

Save your changes and upload your .htaccess file to the server.

That’s all, you have successfully moved your site from subdomain to root domain. You can now visit your website to see it in action. Test out your website to make sure that everything is working fine.

We hope this article helped you move your site from subdomain to root domain. You may also want to see our ultimate WordPress SEO guide for beginners.

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 Properly Move WordPress From Subdomain to Root Domain appeared first on WPBeginner.

How to Easily Create a T-Shirt Shop in WordPress

Recently one of our readers asked if it was possible to add an automated T-Shirt shop in WordPress. Ideally a solution where you simply upload the designs and the rest of the process (printing, shipping, etc) are handled by someone else. Luckily there is a… Read More »

The post How to Easily Create a T-Shirt Shop in WordPress appeared first on WPBeginner.

Recently one of our readers asked if it was possible to add an automated T-Shirt shop in WordPress. Ideally a solution where you simply upload the designs and the rest of the process (printing, shipping, etc) are handled by someone else. Luckily there is a solution. In this article, we will show you how to easily create a t-shirt shop in WordPress with Spreadshirt, so you can add merchandising on your blog.

How to Create a T-Shirt Shop in WordPress With Spreadshirt

Why Build Your T-Shirt Shop in WordPress with Spreadshirt?

Spreadshirt is an online store selling t-shirts with custom designs. Anyone can upload their own custom designs and print them on t-shirts as well as other products.

You can purchase the products for yourself, sell your designs in their marketplace, or create a shop and sell items with your design to your blog readers.

Spreadshirt handles inventory, payments, printing, and shipping. You get paid for the design and comission on each product you sell. This allows you to make money from your blog by selling your custom designed t-shirts and accessories.

Getting Started with WordPress and Spreadshirt

Spreadshirt allows you to create your own Spreadshop with a unique web address. You can display your designs and products on this Spreadshop page.

However, you do not have the same design flexibility in a Spreadshop page that you get with a professional website builder.

If you don’t have a website already, then we recommend using self hosted WordPress.org as your blogging platform (See the difference between WordPress.com vs WordPress.org).

To start a self hosted WordPress.org website, you’ll need a domain name and a WordPress hosting account.

We recommend using Bluehost. They are an officially recommended WordPress hosting provider.

More importantly, they are offering WPBeginner users free domain name and discount on hosting. Basically, you can get started for $2.75 / month.

Once you have purchased hosting, follow the step by step instructions in our guide on how to make a website. You will be up and running in no time.

That being said, let’s take a look at how to create your t-shirt shop with Spreadshirt and add it to your WordPress website,

Creating Your T-Shirt Store with Spreadshirt

First you need to visit Spreadshirt website and click on ‘Sell’ button at the top.

Spreadshirt start selling

Choose ‘Open your own online shop’ option to continue.

You will be asked to create an account and choose a name for your shop.

Create Spreadshirt account and shop

Once you have signed up, you will be taken to your Spreadshirt account dashboard.

Next, click on the Designs option from the left menu to upload your t-shirt designs.

Design your tshirt

You can upload your designs in an image format with supported file types.

Once you upload your design, Spreadshirt will ask you to select products. You can choose clothing for men, women, kids, babies, and accessories.

Select products

After you have chosen the product, click on the next button to continue.

Now you’ll be asked to describe your design. You can add tags and description to explain your design. This information will help Spreadshirt customers discover your design in their marketplace.

Describe design

Once you are done, click on the next button to select your sales channel.

You can sell products with your design on your Spreadshop as well as their Marketplace. Click on the button next to each option to turn them on.

Choose sales channel

After you have enabled the sales channel, click on the next button to continue.

Now you need to set a design price. Your earnings will be the design price + commission.

Set design price

After you have selected the design price, click on the create button to finish the design.

You can continue adding other designs or go to your shop page and publish it.

launch your shop

When publishing the shop, you will be asked to enter your name and address. After that your shop will be live, and you will be ready to sell.

Adding Your Spreadshirt Shop in WordPress

Now that you have designed your t-shirts and created your Spreadshirt shop, it is time to add it to your WordPress site.

Visit your Spreadshirt dashboard and click on the shop icon. On the shop page, you need to click on the edit button.

Edit shop

This will bring up the shop edit section where you need to click on Advanced Settings » Embed Shop in Website menu.

Embed shop in website

You will now see the code which you can copy to paste later on your website. Below the embed code you need to paste the URL of the shop page on your WordPress website.

Embed code

You can now head over to your WordPress admin area and create a new page for your shop. On the shop page, switch to the text editor and then paste the embed code you copied earlier.

Creating your tshirt shop page in WordPress

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

T-shirt shop preview

Want to change the appearance of your Spreadshirt shop? You can do so by editing the shop from your account. You will be able to change the header image, shop title, currency, and more.

We hope this article helped you learn how to create a t-shirt shop in WordPress with Spreadshirt. You may also want to see our step by step WordPress SEO guide for beginners.

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 Easily Create a T-Shirt Shop in WordPress appeared first on WPBeginner.