How To Install WordPress with a Managed Database on Ubuntu 18.04

A previous version of this tutorial was written by Justin Ellingwood

Introduction

WordPress is the most popular CMS (content management system) on the internet. It’s a great choice for getting a website up and running quickly, and after the initial setup, almost all administration can be done through the web frontend.

WordPress is designed to pull content – including posts, comments, user profiles, and other data – from a database backend. As a website grows and must satisfy more and more traffic, it can eventually outgrow its initial database. To resolve this, one can scale up their database by migrating their data to a machine with more RAM or CPU, but this is a tedious process that runs the risk of data loss or corruption. This is why some WordPress developers choose to build their websites on managed databases, which allow users to scale their database automatically with a far lower risk of data loss.

In this guide, we’ll focus on setting up a WordPress instance with a managed MySQL database and an Ubuntu 18.04 server. This will require you to install PHP and Apache to serve the content over the web.

Prerequisites

In order to complete this tutorial, you will need:

  • Access to an Ubuntu 18.04 server: This server should have a non-root sudo-enabled user and a firewall configured. You can set this up by following our Ubuntu 18.04 initial server setup guide.
  • A managed MySQL database: To provision a Managed MySQL Database from DigitalOcean, see our Managed Databases product documentation. Note that this guide will refer to DigitalOcean Managed Databases in examples, but the instructions provided here should also generally work for managed MySQL databases from other cloud providers.
  • A LAMP stack installed on your server: In addition to a database, WordPress requires a web server and PHP to function correctly. Setting up a complete LAMP stack (Linux, Apache, MySQL, and PHP) fulfills all of these requirements. Follow this guide to install and configure this software. As you follow this guide, make sure that you set up a virtual host to point to a domain name that you own. Additionally, be sure to skip Step 2, as installing mysql-server on your machine will make your managed database instance redundant.
  • TLS/SSL security implemented for your site: If you have a domain name, the easiest way to secure your site is with Let’s Encrypt, which provides free, trusted certificates. Follow our Let’s Encrypt guide for Apache to set this up. Note that this will also require you to obtain a domain name and set up DNS records on your server. Follow this introduction to DigitalOcean DNS for details on how to configure this. Altneratively, if you don’t have a domain name, you use a self-signed certificate for your site.

When you are finished with the setup steps, log into your server as your non-root user and continue below.

Step 1 – Adding the MySQL Software Repository and Installing mysql-client

In order to configure your managed MySQL instance, you will need to install a client that will allow you to access the database from your server. This step will walk you through the process of installing the mysql-client package.

In many cases, you can just install mysql-client with the apt command, but if you’re using the default Ubuntu repositories this will install version 5.7 of the program. In order to access a DigitalOcean Managed MySQL database, you will need to install version 8.0 or above. To do so, you must first add the MySQL software repository before installing the package.

Begin by navigating to the MySQL APT Repository page in your web browser. Find the Download button in the lower-right corner and click through to the next page. This page will prompt you to log in or sign up for an Oracle web account. You can skip that and instead look for the link that says No thanks, just start my download. Right-click the link and select Copy Link Address (this option may be worded differently, depending on your browser).

Now you’re ready to download the file. On your server, move to a directory you can write to:

  • cd /tmp

Download the file using curl, remembering to paste the address you just copied in place of the highlighted portion of the following command. You also need to pass two command line flags to curl. -O instructs curl to output to a file instead of standard output. The L flag makes curl follow HTTP redirects, which is necessary in this case because the address you copied actually redirects to another location before the file downloads:

  • curl -OL https://dev.mysql.com/get/mysql-apt-config_0.8.13-1_all.deb

The file should now be downloaded in your current directory. List the files to make sure:

  • ls

You will see the filename listed in the output:

Output
mysql-apt-config_0.8.13-1_all.deb . . .

Now you can add the MySQL APT repository to your system’s repository list. The dpkg command is used to install, remove, and inspect .deb software packages. The following command includes the -i flag, indicating that you’d like to install from the specified file:

  • sudo dpkg -i mysql-apt-config*

During the installation, you’ll be presented with a configuration screen where you can specify which version of MySQL you’d prefer, along with an option to install repositories for other MySQL-related tools. The defaults will add the repository information for the latest stable version of MySQL and nothing else. This is what we want, so use the down arrow to navigate to the Ok menu option and hit ENTER.

Selecting mysql-apt-config configuration options

Following that, the package will finish adding the repository. Refresh your apt package cache to make the new software packages available:

  • sudo apt update

Next, you can clean up your system a bit and delete the file you downloaded, as you won’t need it in the future:

  • rm mysql-apt-config*

Note: If you ever need to update the configuration of these repositories, just run the following command to select your new options:

  • sudo dpkg-reconfigure mysql-apt-config

After selecting your new options, run the following command to refresh your package cache:

  • sudo apt update

Now that you’ve added the MySQL repositories, you’re ready to install the actual MySQL client software. Do so with the following apt command:

  • sudo apt install mysql-client

Once that command finishes, check the software version number to ensure that you have the latest release:

  • mysql --version
Output
mysql Ver 8.0.17-cluster for Linux on x86_64 (MySQL Community Server - GPL)

You’re now able to connect to your managed database and begin preparing it to function with WordPress.

Step 2 – Creating a MySQL Database and User for WordPress

WordPress uses MySQL to manage and store site and user information. Assuming you have completed all the prerequisite tutorials, you will have already provisioned a managed MySQL instance. Here, we’ll take the preparatory step of creating a database and a user for WordPress to use.

Most managed database providers provide a uniform resource identifier (URI) used for connecting to the database instance. If you’re using a DigitalOcean Managed Database, you can find the relevant connection information in your Cloud Control Panel.

First, click Databases in the left-hand sidebar menu and select the MySQL database you want to use for your WordPress installation. Scroll down to the Connection Details section and copy the link in the host field. Then paste this link into the following command, replacing host_uri with the information you just copied. Likewise, copy the port number in the port field – which will be 25060 on a DigitalOcean Managed Database – and replace port with that number. Additionally, if this is your first time connecting to your managed database and you’ve not created your own administrative MySQL user, copy the value in the username field and paste it into the command, replacing user:

  • mysql -u user -p -h host_uri -P port

This command includes the -p flag, which will prompt you for the password of the MySQL user you specified. For a DigitalOcean Managed Database’s default doadmin user, you can find this by clicking the show link in the Connection Details section to reveal the password. Copy and paste it into your terminal when prompted.

Note: If you are not using a DigitalOcean Managed Database, your connection options may differ. If that’s the case, you should consult your provider’s documentation for instructions on connecting third party applications to your database.

From the MySQL prompt, create a new database that WordPress will control. You can call this whatever you would like, but we will use the name wordpress in this guide to keep it simple. Create the database for WordPress by typing:

  • CREATE DATABASE wordpress DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;

Note: Every MySQL statement must end in a semi-colon (;). Check to make sure this is present if you are running into any issues.

Next, create a new MySQL user account that you will use exclusively to operate on the new database. Creating single-purpose databases and accounts is a good idea from a management and security standpoint. We will use the name wordpressuser in this guide, but feel free to change this if you’d like.

Run the following command, but replace your_server_ip with your Ubuntu server’s IP address. Be aware, though, that this will limit wordpressuser to only be able to connect from your LAMP server; if you plan to manage WordPress from your local computer, you should enter that machine’s IP address instead. Additionally, choose a strong password for your database user:

  • CREATE USER 'wordpressuser'@your_server_ip IDENTIFIED WITH mysql_native_password BY 'password';

Note: If you do not know what your server’s public IP address is, there are a number of ways you can find it. Usually, this is the address you use to connect to your server through SSH.

One method is to use the curl utility to contact an outside party to tell you how it sees your server. For example, you can use curl to contact an IP-checking tool like ICanHazIP:

  • curl http://icanhazip.com

This command will return your server’s public IP address in your output.

Then grant this user access to the database you just created. Do so by running the following command:

  • GRANT ALL ON wordpress.* TO 'wordpressuser'@your_server_ip;

You now have a database and user account, each made specifically for WordPress. Next, you need to flush the privileges so that the current MySQL session recognizes the changes you’ve made:

  • FLUSH PRIVILEGES;

Following that, exit out of MySQL by typing:

  • exit

That takes care of configuring your managed MySQL database to function with WordPress. In the next step, you will install a few PHP extensions in order to get more functionality out of the CMS.

Step 3 – Installing Additional PHP Extensions

Assuming you followed the prerequisite LAMP stack tutorial, you will have installed a few extensions intended to get PHP to properly communicate with MySQL. WordPress and many of its plugins leverage additional PHP extensions to add additional functionalities.

To download and install some of the more popular PHP extensions for use with WordPress, run the following command:

  • sudo apt install php-curl php-gd php-mbstring php-xml php-xmlrpc php-soap php-intl php-zip

Note: Each WordPress plugin has its own set of requirements. Some may require you to install additional PHP packages. Check your plugin documentation to see which extensions it requires. If they are available, they can be installed with apt as demonstrated above.

You will restart Apache to load these new extensions in the next section. If you’re returning here to install additional plugins, though, you can restart Apache now by typing:

  • sudo systemctl restart apache2

Otherwise, continue on to Step 4.

Step 4 – Adjusting Apache’s Configuration to Allow for .htaccess Overrides and Rewrites

In order for Apache to be able to properly serve your WordPress installation, you must make a few minor adjustments to your Apache configuration.

If you followed the prerequisite tutorials, you should already have a configuration file for your site in the /etc/apache2/sites-available/ directory. We’ll use /etc/apache2/sites-available/your_domain.conf as an example here, but you should substitute the path to your configuration file where appropriate.

Additionally, we will use /var/www/your_domain as the root directory in this example WordPress install. You should use the web root specified in your own configuration.

Note: It’s possible you are using the 000-default.conf default configuration (with /var/www/html as your web root). This is fine to use if you’re only going to host one website on this server. If not, it’s best to split the necessary configuration into logical chunks, one file per site.

Currently, the use of .htaccess files is disabled. WordPress and many WordPress plugins use these files extensively for in-directory tweaks to the web server’s behavior.

Open the Apache configuration file for your website:

  • sudo nano /etc/apache2/sites-available/your_domain.conf

To allow .htaccess files, you need to set the AllowOverride directive within a Directory block pointing to your document root. Add the following block of text inside the VirtualHost block in your configuration file, being sure to use the correct web root directory:

/etc/apache2/sites-available/your_domain.conf
<Directory /var/www/your_domain>     AllowOverride All </Directory> 

When you are finished, save and close the file.

Next, enable mod_rewrite so that you can employ the WordPress permalink feature:

  • sudo a2enmod rewrite

Before implementing the changes you’ve just made, check to make sure there aren’t any syntax errors in your configuration file:

  • sudo apache2ctl configtest

The output might have a message that looks like this:

Output
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'ServerName' directive globally to suppress this message Syntax OK

If you wish to suppress the top line, just add a ServerName directive to your main (global) Apache configuration file at /etc/apache2/apache2.conf. The ServerName can be your server’s domain or IP address. However, this is just a message; it doesn’t affect the functionality of your site and as long as the output contains Syntax OK, you’re all set to continue.

Restart Apache to implement the changes:

  • sudo systemctl restart apache2

With that, you’re ready to download and set up WordPress itself.

Step 5 – Downloading WordPress

Now that your server software is configured, you can install and configure WordPress. For security reasons, it is always recommended to get the latest version of WordPress from their site.

First, navigate to into a writable directory. /tmp will work for the purposes of this step:

  • cd /tmp

Then download the compressed release by typing:

  • curl -O https://wordpress.org/latest.tar.gz

Extract the compressed file to create the WordPress directory structure:

  • tar xzvf latest.tar.gz

You will move these files into your document root momentarily. Before doing so, add a dummy .htaccess file so that this will be available for WordPress to use later.

Create the file by typing:

  • touch /tmp/wordpress/.htaccess

Also, copy over the sample configuration file to the filename that WordPress actually reads:

  • cp /tmp/wordpress/wp-config-sample.php /tmp/wordpress/wp-config.php

Create an upgrade directory, so that WordPress won’t run into permissions issues when trying to do this on its own following an update to its software:

  • mkdir /tmp/wordpress/wp-content/upgrade

Then copy the entire contents of the directory into your document root. The following command uses a period at the end of the source directory to indicate that everything within the directory should be copied, including hidden files (like the .htaccess file you just created):

  • sudo cp -a /tmp/wordpress/. /var/www/your_domain

That takes care of downloading WordPress onto your server. At this point, though, you still won’t be able to access the WordPress setup interface in your browser. To fix that, you’ll need to make a few changes to your server’s WordPress configuration.

Step 6 – Configuring the WordPress Directory

Before going through the web-based WordPress setup, you need to adjust some items in your WordPress directory. One important configuration change involves setting up reasonable file permissions and ownership.

Start by giving ownership of all the files to the www-data user and group. This is the user that the Apache web server runs as on Debian and Ubuntu systems, and Apache will need to be able to read and write WordPress files in order to serve the website and perform automatic updates.

Update the ownership of your web root directory with chown:

  • sudo chown -R www-data:www-data /var/www/your_domain

Next run the following two find commands to set the correct permissions on the WordPress directories and files:

  • sudo find /var/www/your_domain/ -type d -exec chmod 750 {} \;
  • sudo find /var/www/your_domain/ -type f -exec chmod 640 {} \;

These should be a reasonable permissions set to start with. Be aware, though, that some plugins and procedures might require additional updates.

Now, you need to make some changes to the main WordPress configuration file.

When you open the file, the first order of business will be to replace some secret keys to provide security for your installation. WordPress provides a secure generator for these values so that you do not have to try to come up with good values on your own. These are only used internally, so it won’t hurt usability to have complex, secure values here.

To grab secure values from the WordPress secret key generator, run the following command:

  • curl -s https://api.wordpress.org/secret-key/1.1/salt/

You will get back unique values that look something like this:

Warning! It is important that you request unique values each time. Do NOT copy the values shown here!

Output
define('AUTH_KEY', '1jl/vqfs<XhdXoAPz9 DO NOT COPY THESE VALUES c_j{iwqD^<+c9.k<J@4H'); define('SECURE_AUTH_KEY', 'E2N-h2]Dcvp+aS/p7X DO NOT COPY THESE VALUES {Ka(f;rv?Pxf})CgLi-3'); define('LOGGED_IN_KEY', 'W(50,{W^,OPB%PB<JF DO NOT COPY THESE VALUES 2;y&,2m%3]R6DUth[;88'); define('NONCE_KEY', 'll,4UC)7ua+8<!4VM+ DO NOT COPY THESE VALUES #`DXF+[$ atzM7 o^-C7g'); define('AUTH_SALT', 'koMrurzOA+|L_lG}kf DO NOT COPY THESE VALUES 07VC*Lj*lD&?3w!BT#-'); define('SECURE_AUTH_SALT', 'p32*p,]z%LZ+pAu:VY DO NOT COPY THESE VALUES C-?y+K0DK_+F|0h{!_xY'); define('LOGGED_IN_SALT', 'i^/G2W7!-1H2OQ+t$ 3 DO NOT COPY THESE VALUES t6**bRVFSD[Hi])-qS`|'); define('NONCE_SALT', 'Q6]U:K?j4L%Z]}h^q7 DO NOT COPY THESE VALUES 1% ^qUswWgn+6&xqHN&%');

These are configuration lines that you can paste directly into your configuration file to set secure keys. Copy the output you received now.

Then, open the WordPress configuration file:

  • sudo nano /var/www/your_domain/wp-config.php

Find the section that contains the dummy values for those settings. It will look something like this:

/var/www/your_domain/wp-config.php
. . .  define('AUTH_KEY',         'put your unique phrase here'); define('SECURE_AUTH_KEY',  'put your unique phrase here'); define('LOGGED_IN_KEY',    'put your unique phrase here'); define('NONCE_KEY',        'put your unique phrase here'); define('AUTH_SALT',        'put your unique phrase here'); define('SECURE_AUTH_SALT', 'put your unique phrase here'); define('LOGGED_IN_SALT',   'put your unique phrase here'); define('NONCE_SALT',       'put your unique phrase here');  . . . 

Delete those lines and paste in the values you copied from the command line:

/var/www/your_domain/wp-config.php
. . .  define('AUTH_KEY',         'VALUES COPIED FROM THE COMMAND LINE'); define('SECURE_AUTH_KEY',  'VALUES COPIED FROM THE COMMAND LINE'); define('LOGGED_IN_KEY',    'VALUES COPIED FROM THE COMMAND LINE'); define('NONCE_KEY',        'VALUES COPIED FROM THE COMMAND LINE'); define('AUTH_SALT',        'VALUES COPIED FROM THE COMMAND LINE'); define('SECURE_AUTH_SALT', 'VALUES COPIED FROM THE COMMAND LINE'); define('LOGGED_IN_SALT',   'VALUES COPIED FROM THE COMMAND LINE'); define('NONCE_SALT',       'VALUES COPIED FROM THE COMMAND LINE');  . . . 

Next you need to modify some of the database connection settings at the beginning of the file. First, update the 'DB_NAME', 'DB_USER', and 'DB_PASSWORD' fields to point to the database name, database user, and the associated password that you configured within MySQL:

/var/www/your_domain/wp-config.php
. . . /** The name of the database for WordPress */ define('DB_NAME', 'wordpress');  /** MySQL database username */ define('DB_USER', 'wordpressuser');  /** MySQL database password */ define('DB_PASSWORD', 'password');  . . . 

You will also need to replace localhost in the 'DB_HOST' field with your managed database’s host. Additionally, append a colon (:) and your database’s port number to the host:

/var/www/wordpress/wp-config.php
. . .  /** MySQL hostname */ define( 'DB_HOST', 'managed_database_host:managed_database_port' );  . . . 

The last change you need to make is to set the method that WordPress will use to write to the filesystem. Since you’ve already given the web server permission to write where it needs to, you can explicitly set the filesystem method to direct port. Failure to set this with your current settings would result in WordPress prompting for FTP credentials when you perform certain actions.

This setting can be added below the database connection settings, or anywhere else in the file:

/var/www/your_domain/wp-config.php
. . .  define('FS_METHOD', 'direct'); . . . 

Save and close the file when you are finished.

After making those changes, you’re all set to finish the process of installing WordPress in your web browser. However, there’s one more step that we recommend you complete to add an extra layer of security to your configuration.

At this point, your WordPress installation is communicating with your managed MySQL database. However, there’s no guarantee that data transfers between the two machines are secure. In this step, we will configure WordPress to communicate with your MySQL instance over a TLS/SSL connection to ensure secure communications between the two machines.

To do so, you’ll need your managed database’s CA certificate. For a DigitalOcean Managed Database, you can find this by once again navigating to the Databases tab in your Control Panel. Click on your database, and find the Connection Details section. There will be a button there that reads Download the CA certificate. Click this button to download the certificate to your local machine.

Then transfer this file to your WordPress server. If your local machine is running Linux or macOS, you can use a tool like scp:

  • scp /path/to/file/ca-certificate.crt sammy@your_server_ip:/tmp

If your local machine is running Windows, you can use an alternative tool like WinSCP.

Once the CA certificate is on your server, move it to the /user/local/share/ca-certificates/ directory, Ubuntu’s trusted certificate store:

  • sudo mv /tmp/ca-certificate.crt /usr/local/share/ca-certificates/

Following this, run the update-ca-certificates command. This program looks for certificates within /usr/local/share/ca-certificates, adds any new ones to the /etc/ssl/certs/ directory, and generates a list of trusted SSL certificates based on its contents:

  • sudo update-ca-certificates

Then, reopen your wp-config.php file:

  • nano /var/www/your_domain/wp-config.php

Somewhere in the file, add the following line:

/var/www/your_domain/wp-config.php
. . . define('MYSQL_CLIENT_FLAGS', MYSQLI_CLIENT_SSL); . . . 

Save and close the file.

Following that, WordPress will securely communicate with your managed MySQL database.

Step 8 – Completing the Installation Through the Web Interface

Now that the server configuration is complete, you can complete the installation through the WordPress web interface.

In your web browser, navigate to your server’s domain name or public IP address:

https://server_domain_or_IP 

Assuming there aren’t any errors in your WordPress or Apache configurations, you’ll see the WordPress language selection splash page. Select the language you would like to use:

WordPress language selection

After selecting your language, you will see the main setup page.

Select a name for your WordPress site and choose a username (it is recommended not to choose something like “admin” for security purposes). A strong password is generated automatically. Save this password or enter an alternative strong password.

Enter your email address and select whether you want to discourage search engines from indexing your site:

WordPress setup installation

When you click ahead, you will be taken to a page that prompts you to log in:

WordPress login prompt

Once you log in, you will be taken to the WordPress administration dashboard:

WordPress login prompt

From here, you can begin customizing your new WordPress site and start publishing content. If this is your first time using WordPress, we encourage you to explore the interface a bit to get acquainted with your new CMS.

Conclusion

By completing this guide, you will have WordPress installed and ready to use on your server. Additionally, your WordPress installation is dynamically pulling posts, pages, and other content from your managed MySQL database.

Some common next steps are to choose the permalinks setting for your posts. This setting can be found under Settings > Permalinks. You could also select a new theme in Appearance > Themes. Once you start loading some content into your site, you could also configure a CDN to speed up your site’s asset delivery.

DigitalOcean Community Tutorials

How to Get WordPress.com Features on Self-Hosted WordPress Blogs

If you recently switched from WordPress.com to your own self-hosted WordPress.org website, then you may not see all the widgets, stats, and other WordPress.com features in the new user interface.

But don’t worry, there’s an easy way to get those features back. Actually, you can have even more powerful features with your self-hosted WordPress blog.

In this article, we will show you how to get WordPress.com features on self-hosted WordPress blogs.

Getting WordPress.com features for your WordPress.org blogs

Adding WordPress.com Features to Your Self-Hosted WordPress Blog

When choosing a blogging platform, many users start with WordPress.com before they make the switch to the self-hosted WordPress.org platform. Often this happens due to name confusion because despite the similar name, they are two different platforms. To learn more see our comparison of WordPress.com vs WordPress.org.

The problem is that after using WordPress.com, you can get used to certain features and the way they look. Naturally, after switching you would want to have the same features in self-hosted WordPress.

While WordPress.org doesn’t offer built-in features like WordPress.com, it gives you the full flexibility to add any feature that you want on your website using WordPress plugins. In fact, this flexibility is one of the major reasons why people convert their WordPress.com blogs to WordPress.org.

The company behind WordPress.com offers a plugin that brings WordPress.com features on any WordPress.org website. This plugin is called JetPack.

Jetpack WordPress Plugin

Jetpack offers many of the same features used by WordPress.com to WordPress.org users.

Unlike standard WordPress plugins, Jetpack is a plugin suite which combines several useful features into a single plugin.

Jetpack Features on Self-hosted WordPress Blog

Here are the main Jetpack (WordPress.com) features:

  • WordPress Security: Downtime monitoring, brute force attack protection, backups, etc.
  • Performance: Speed up image and static file load times, lazy loading for images, etc.
  • Writing and content: Options to create galleries, testimonials, portfolios, Infinite scroll, etc.
  • Social sharing: Auto social sharing posts, share buttons, and like buttons.
  • Website traffic: Related posts, website stats, etc.

Jetpack is available as a free plugin with certain features being premium upgrades. You can simply install the plugin like any other plugin on your self-hosted WordPress site to access the same basic features that you had on WordPress.com.

However, one of the reasons why people is to get away from the limited features on WordPress.com and access the more powerful features offered on self-hosted WordPress.org.

In that case, here’s how you can unlock more powerful features with WordPress.org.

1. Unlock Powerful Analytics with MonsterInsights

Website stats is one of the most loved WordPress.com features. Jetpack provides this feature with the built-in site stats module.

However, it’s nowhere near as powerful as Google Analytics, the de-facto market leader for analytics. If you want to integrate Google Analytics with Jetpack, then you need to subscribe to their professional plan that costs $ 299 / year.

But luckily, you can use the most powerful website stats tool Google Analytics on your self-hosted blog with MonsterInsights Lite plugin which is 100% free.

MonsterInsights Best Google Analytics WordPress Plugin

MonsterInsights also offers a Pro version which is the best Google Analytics WordPress plugin in the market. It lets you easily connect your site with Google Analytics and helps to track advanced metrics with ease.

Get MonsterInsights now!

2. Create Smart WordPress Forms with WPForms

You can create contact forms and polls in WordPress.com with Jetpack’s feedback form feature. But it lacks the advanced options to customize the forms or add smart marketing features.

WPForms plugin solves that problem for self-hosted WordPress blogs by allowing you to create any type of form with just a few clicks. The free version, WPForms Lite, comes with all the essentials, and the Pro version is packed with more powerful features.

WPForms

Using WPForms, you can create contact forms, surveys, user registration forms, order forms, etc. quickly and easily.

Get WPForms now!

3. Get More Robust WordPress Security with Sucuri

Jetpack free version offers basic WordPress security features like brute force attack protection. If you upgrade to their premium plans, then you will get malware scanning option as well.

However you can get more robust security features for your self-hosted website with plugins like Sucuri.

Sucuri

Sucuri’s free WordPress plugin has advanced security options like remote malware scanning, blacklist monitoring, file integrity monitoring, security activity auditing, and more.

Get Sucuri now!

4. Get Advanced SEO Features with Yoast SEO plugin

Jetpack offers basic SEO features like XML sitemaps and site verification for WordPress.com websites. You need to buy at least the Jetpack Premium plan to access all of its SEO features.

You can get all those features and more in your self-hosted WordPress blog with free Yoast SEO plugin.

Yoast SEO

Yoast SEO offers features like site verification, XML sitemaps, SEO preview, Facebook and Twitter preview images, title, meta descriptions, and more.

If you buy the paid version of the plugin, you can get more powerful SEO capabilities.

Get Yoast SEO now!

5. Create Automatic Backups with UpdraftPlus

You can create daily automatic backups for your WordPress site with Jetpack; however, it’s only available for the paid users.

But thankfully UpdraftPlus plugin lets you set up automatic backups for your website free.

UpdraftPlus best WordPress backup plugin

It also allows you to store your WordPress backups in remote locations such as Google Drive, and Dropbox.

Get UpdraftPlus now!

6. Enable Spam Filtering Free with Akismet

Jetpack paid plan users can enjoy spam filtering feature on their website. It is enabled by Akismet plugin integration.

But you can get this feature for free in your self-hosted WordPress website by installing the Akismet plugin.

Akismet

Akismet automatically checks all your WordPress comments and filters out the ones which look like spam. It helps to reduce spam comments significantly on your site and allows you peace of mind.

Get Akistmet now!

7. Add Stylish Social Share Buttons with Shared Counts

Social sharing buttons are also a default WordPress.com feature. You can enable social share buttons on your posts, pages, media, etc. however, it has limited styling options.

You can use Shared Counts plugin on your self-hosted WordPress website to get the social sharing buttons.

Shared Counts

Shared Counts offers many display styles, social share count, and total share count feature.

Another great advantage of using Shared Counts is that it doesn’t slow your website speed.

Get Shared Counts now!

8. Auto Post to Your Social Networks with WP to Buffer

You can enable auto-sharing your posts on your social media networks in WordPress.com using Jetpack’s Publicize feature.

You can add the same functionality to your self-hosted WordPress blog by using WP to Buffer plugin.

WP to Buffer

Buffer is a popular social media management tool you can use to schedule posts on social media.

With WP to Buffer free plugin, you can connect your WordPress.org website with your Buffer account and set up automatic posting on your social media profiles.

Get WP to Buffer now!

9. Show Related Content with Yet Another Related Posts

WordPress.com has a built-in option to show related content after posts.

You can add this feature on your WordPress.org website using the free plugin Yet Another Related Posts.

Yet Another Related Posts Plugin

The plugin allows you to display posts, pages, and custom post types as related content after posts. You can choose thumbnail or list view of related content.

Get Yet Another Related Posts now!

10. Improve Comment Interaction with De:comments

You can enable Like option for your WordPress.com comments. This feature is useful to improve user-interaction in your comment area.

De:comments plugin lets you add more elements of user interaction to your WordPress.org comment area.

De:comments

The plugin allows users to rate comments, share comments on social media, earn badges, and more.

Get De:comments now!

11. Grow Your Email List and Send Emails with Constant Contact

Jetpack offers basic email marketing features for WordPress.com websites. You can add a simple subscription form on your site, and send emails when you publish a new post.

You can use more powerful email marketing features on your self-hosted WordPress blog with Constant Contact.

Constant Contact

Constant Contact is one of the best email marketing service provider on the market. It allows you to easily collect email addresses, convert visitors into subscribers, and bring them back to your website.

For detailed instructions, see our article on how to create an email newsletter in WordPress.

Get Constant Contact now!

12. Get CDN Services with Cloudflare

WordPress.com has built-in CDN for images and static files.

You can get a similar feature on your self-hosted blog with Cloudflare.

Cloudflare

Cloudflare is one of the best CDN services available in the market.

Using this service helps to improve your website speed and performance. Also, it protects your site against brute force attacks.

Get Cloudflare now!

13. Enable Infinite Scrolling with WordPress Infinite Scroll

One of the popular WordPress.com features is infinite scrolling. Many websites use this feature to improve user engagement.

You can add the same feature to your WordPress.org website using the free WordPress Infinite Scroll plugin.

Load More - Infinite scroll for WordPress

It is an excellent tool for lazy loading posts, pages, comments, and more.

Get WordPress Infinite Scroll now!

14. Create Stunning Galleries with Envira Gallery

In WordPress.com, you can create responsive galleries with Jetpack. It is also a built-in WordPress.com feature. However, it has limited customization options.

You can add more stunning image galleries on your self-hosted WordPress blog with Envira Gallery plugin.

Envira Gallery

Get Envira Gallery plugin now!

We hope this article helped you to learn how to get WordPress.com features on self-hosted WordPress blogs. You may also want to see our guide on the 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.

The post How to Get WordPress.com Features on Self-Hosted WordPress Blogs appeared first on WPBeginner.

WPBeginner

How to Manage and Delete Transients in WordPress

WordPress plugin and theme developers often use transients API to store timely information in your WordPress database.

This allows them to reuse this information and make their plugins function faster. While this is an incredible performance technique, sometimes it may affect your website during testing or development.

For example, you may realize that certain elements like popular posts or Twitter widgets are not changing despite emptying WordPress cache.

That’s usually because the transient for that particular feature is not working as expected. To fix the issue, your options are to wait until transients expire or manually fix it.

In this article, we will show you how to easily manage and delete transients in WordPress.

How to easily manage transients in WordPress

What is Transients?

The Transients API in WordPress allows developers to store information in your WordPress database with an expiration time. This helps improve WordPress performance and speed up your website while reducing overall server load.

For example, many WordPress social media plugins use transients to retrieve and store share counts for posts.

If they didn’t use transients, then your server will need to connect with all social networks on each page load which will slow down your site significantly.

Example of data stored in transients by a plugin

That’s why transients are awesome.

Now you may be wondering, why would you ever want to manage or delete transients?

Well, things can go wrong sometimes. Let’s say a connection between Facebook and your site didn’t go so well, and now it’s showing a count of 0. You can wait 30 minutes or sometimes longer for a transient to expire, or you can clear out the transient cache and get the most accurate count.

It also helps when testing a plugin to make sure that it’s really working like it is supposed to.

Last but not least, you may want to delete expired transients to clear out your database. This comes in handy when you are moving a staging site to live WordPress hosting server.

Are WordPress transients like cookies?

WordPress transients are like cookies but only in the sense that they both allow developers to store temporary information. However, transients are much more powerful.

For example, cookies are stored in the user’s browser and have several limitations. They are also less secure and not as programable.

Transients, on the other hand, are stored in the WordPress database, can store different types of data, more secure, and easily programmable with the transients API.

That being said, let’s take a look at how to easily manage transients in WordPress and delete them when needed.

Managing Transients in WordPress

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

Upon activation, you need to visit Tools » Transients page to view and manage transients used by your WordPress site.

Managing transients in WordPress

From here you will see a list of transients stored in your WordPress database.

This page lets you perform the following bulk actions:

  • Delete expired transients
  • Delete all transients with an expiry date
  • Delete all transients

You can also look at transients listed below to edit or delete individual transients as needed. You can identify a transient by looking at its name.

Most trusted WordPress theme and plugin developers will use the product name in the transient to make it easily identifiable.

Right next to the name column, you’ll see the value for each particular transient. The transients value could be an object, array, number or alphanumeric string as the value.

You’ll also see an expiration time for each transient. Some of them may not have an expiration time set and will be displayed as ‘Does not expire’.

You can delete any of these transients or click on the Edit button to change their value.

Editing a single transient in WordPress

This feature comes in handy when you are testing a theme or plugin and want to check it with different transient values.

We hope this article helped you learn how to easily manage and delete transients in WordPress. You may also want to see our list of most useful WordPress tips, tricks, and hacks for more neat ideas to use WordPress like a pro.

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 Manage and Delete Transients in WordPress appeared first on WPBeginner.

WPBeginner

A better website search with SearchIQ for WordPress!

We all know the standard search function in WordPress doesn’t provide the most relevant results. I don’t blame WordPress for this shortcoming, but the MySQL database system in the backend. The “fulltext” search index doesn’t work very well or is not flexible enough to provide relevant search results for “complex” search queries or even queries […]

Originally published by Web Development Blog

Web Development Blog

How to Add Image Credits in WordPress (Step by Step)

Recently, some of our readers asked us about how to properly add image credits in WordPress.

Image credits are a way to let users know about the original creator of the image that you are using on your website. It shows good faith and also protects you from legal issues.

In this article, we will show you how to properly add image credits in WordPress. We will also talk more about why it is important, and what are the consequences of not doing it.

Adding image credit and attribution in WordPress

When and Why Add Image Credits in WordPress?

Images are highly engaging, and they make your blog posts look visually appealing. However, you cannot just copy any image from the web and add it to your blog posts.

All images on the internet are protected by copyright laws. You can only use them with permission from the copyright owner.

Some photographers and artists occasionally release their work under licenses that allow others to use their images. However, often these licenses require you to give proper credit to the original creator.

Why Adding Image Credit is Important?

All images on the internet are protected by copyright laws including the ones where you cannot see a copyright notice. This means you cannot use them on your website without permission.

If the image author specifically states that their photos can be re-used under licenses like creative commons, then you must add image credit and provide proper attribution to the original work.

It is really important to give proper image credit to comply with the copyright laws and avoid infringing upon someone’s rights.

It is a show of respect for other people’s work and creativity. It also protects you against legal issues and liabilities caused by violating intellectual property rights and copyright laws.

What are the Consequences of Not Giving Image Credits?

Many beginners believe that the internet is very large, and no one would even notice that they have used an image without permission.

This used to be true in the old days where you could get away with stealing images, but things are changing fast.

Now, there is an entire industry of lawyers who’re focused on recovering image copyright claims. They use reverse image search tools to send bulk cease and desist mails along with settle demand letters.

We know several bloggers and business owners who have paid hundreds of dollars in damages just for a single image.

If you are serious about growing your business online, then you need to take copyright laws seriously from day one.

Copyright laws are applicable globally. This means they apply regardless of where you or the original creator lives.

As mentioned above, the first most serious consequence is that you can be sued for violation of copyright laws. These legal troubles can cost a lot of money and may even destroy your website, and its reputation.

Copyright laws also apply to search engines like Google and web hosting companies.

The original copyright owner can file a DMCA complaint against your website to search engines which will force them to remove that content from search results.

They can also ask your hosting provider to remove the content in which case they will be legally obliged to ask you for the removal of the image. Some companies may just suspend your hosting account and inform you later.

How to Properly Add Image Credits in WordPress

WordPress lets you easily add image credits below an image. Here is how to properly add image credits in WordPress without using any extra plugin.

First, you need to upload the image to your WordPress post or page. Simply add an image block to the content editor and then click on the upload button to select an image from your computer.

Adding an image block to upload a new image in WordPress

You can also select a previously uploaded image by clicking on the media library button.

Once you select an image, it will automatically appear in the post editor. Below the image, you’ll see a prompt to ‘Write a caption’.

Write a caption

Captions can be used to describe an image or photograph. They can also be used to add image credit and give proper attribution to the original copyright owner.

Format caption credit and add links

You can add image credit text in the caption field. Some copyright owners may require you to also add a link back to the original source.

If they do, then you can simply click on the insert link button and add the link to the original file.

Once you are done, you can go ahead and save your changes.

To learn more about using captions, see our article on how to add captions to images in WordPress.

How to Find the Image Credit and License Information

Most images you’ll find on the internet do not contain licensing information. This means that you don’t have permission to use those images.

Luckily, there are many websites where you can find images to use. However, some of these image websites may require you to provide attribution or image credit.

You can find this information on the image download page. For example, this is how Flickr shows licensing information on the image page.

Licensing information for an image on Flickr

Clicking on the link will provide you more details about the license. It will also describe if you need to give credit and how to properly do that.

License information

How to Avoid Giving Image Credits in WordPress

You need to carefully read the license to understand how you are required to provide the image credit.

Most such licenses will explicitly require you to provide a link back to the original source.

Adding links to the photographer’s website or the photo is a bit problematic. In most cases, the link is not relevant to the actual content on your website. It would allow users to leave your website, and they may not come back.

This is why we recommend using royalty-free stock photo websites.

These websites curate photographs, images, and illustrations that do not require image credit. You can also use these images on business websites.

Following are our top picks for free stock photo websites:

  • Unsplash – A large collection of royalty-free photographs neatly organized in categories and tags.
  • Pixabay – One of the largest and most popular license-free images and photos
  • Public Domain Archive – A collection of images and photographs available under public domain
  • Picjumbo – Another large collection of royalty-free images
  • New Old Stock – A collection of vintage photographs that are now available under public domain

For more options, see our complete list of the best places to find free stock photos.

On WPBeginner, we extensively use Shutterstock which is a premium stock photo and illustration website.

The problem with stock images though is that these images are already used on thousands of websites. You may also struggle with finding the right image to accompany your articles.

The simplest way to fix this is by using your own original photographs and graphics. The challenge is that most users are not graphic designers.

Luckily, there are websites that allow you to easily create graphics to use on your website. These image editors come with drag and drop tools and ready-made templates to give you a good starting point.

Following are some of the best online graphic editing tools for beginners.

  • Canva – An easy to use graphic design tool for beginners to create custom logos, banners, images, infographs, charts, and more.
  • Piktochart – Easy to use tool to make beautiful presentations, banners, charts, and graphics
  • Pablo – Allows you to create beautiful graphics for social media and blogs.
  • PicMonkey – Another easy to use image editor for bloggers

We hope this article helped you learn how to add image credit in WordPress and why it is important. You may also want to see our guide on how to optimize your images for SEO and get more traffic.

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 Image Credits in WordPress (Step by Step) appeared first on WPBeginner.

WPBeginner