MailChimp made a change earlier in the year to become more of a marketing platform, which was also accompanied by a pricing increase in their plans. Due to this change, we have reviewed several reliable options which may make choosing a replacement easier! We considered three other services which may be a better alternative; they are EmailOctopus, Moosend, and MailBuster.
There may be times when you need to clean up post revisions created on your site. This is possible, using the commands already available in WP-CLI.
WP-CLI has a wp post delete command which can be used to delete post revisions. Post revisions are changes made to content on your site, over time those post revisions on your site can mount up. The following directions assume you are using one of Liquid Web’s Managed WordPress or Managed WooCommerce products. You can also use these techniques with other WordPress installations, just be sure to run the commands from the primary WordPress installation folder.
Preparing to Run Commands
One of the first steps will be to generate sFTP/SSH credentials from your site manager. You can use Terminal on the Mac, or Putty on a PC to use WP-CLI. For more information about logging into your server using SSH, see Logging into Your Server via Secure Shell (SSH).
Log in, then go to the WordPress installation folder by entering:
It is always a good idea to create a database backup before making significant changes to your site, like bulk deleting post revisions. To create a manual backup run this command:
wp db export
You can now use gzip to compress the resulting sql file which will mean a smaller file being stored on your server:
Cleaning Up Your Post Revisions
To delete post all revisions (moving them temporarily into the trash), use this WP-CLI command:
wp post delete $(wp post list --post_type='revision' --format=ids)
To delete the post revisions which have been moved to the trash (this includes all post revisions which have a post status of trash), run this command:
wp post delete $(wp post list --post_type='revision' --format=ids --force)
You can skip the first step of moving the posts to the trash by just running the second command. This will remove all post revisions, both those in the trash and those that are in the active portion of the site.
More Control Over Post Revisions Removal
If you need more control of deleting post revisions, there is a package which can be installed from a third-party for WP-CLI. Please note: This package is not provide by Liquid Web nor is it endorsed by Liquid Web. Please use at your own discretion.
To install the package for WP-CLI, run the following command:
wp package install trepmal/wp-revisions-cli
After the package WP Revisions has been installed, to clean all post revisions, you can use the following command. Please note: this command can be slow, since it will query post revisions before deleting them.
wp revisions clean -1
If you wanted to delete all post revisions before a specific date, you can include that in the command. For example:
wp revisions clean --before-date=2019-06-10
If you needed to clean all post revisions other than those for a specific post type, include that post type at the end of the command. For example, revisions for the WooCommerce created product post type would not be deleted if you run this command:
wp revisions clean --post_type=product
For a faster method to delete all post revisions, you can run this command:
wp revisions dump --hard
To list all existing post revisions, you can run this command:
wp revisions list
Easily deleting post revisions from your site database will help keep the database cleaned up. Streamlining the database can result in performance improvements, especially as the size of the database grows.
If you do not keep site plugins updated along with WordPress core updated, then you run into the chance of your site being hacked or infected by Malware. If your site does get infected by malware, a way to easily find any of the non-standard WordPress core and plugin files is by using the verify checksums commands in WP-CLI (the WordPress Command Line Interface).
Preparing to Run Commands
First, you will need to login to your portal via SSH. For directions on generating credentials for sFTP/SSH creds from your site manager, see Finding Your SFTP/SSH Credentials in Managed WordPress Portal. For help using SSH, see Logging into Your Server via Secure Shell (SSH).
Security plugins have definite uses, but when you need to verify WordPress core as well as all installed plugins on the WordPress.org checksums, plugins are just not the appropriate tool. WP-CLI already has checksum commands for both WordPress core and all plugins.
- To verify that all WordPress core files checksum match, the WP-CLI command to run is:
wp core verify-checksums
- To verify checksum against specific versions of WordPress, you can include the version number in the command. To verify for version 5.2.1 of WordPress core, for example, the command would be:
wp core verify-checksums --version=5.2.1
- If you were using an older version of WordPress, for example version 4.9.10, the command would be:
wp core verify-checksums --version=4.9.10
- To verify the checksum of all plugins which are installed on your site server (this would only include plugins available from WordPress), then the command to run would be:
wp plugin verify-checksums --all
- To verify the checksums of a specific plugin (e.g., WooCommerce), you will need to know the plugin “slug” (or short name). You can find the slug by looking in the plugins links on the WordPress website.
The plugin slug for WooCommerce is woocommerce, so to verify the checksums of the WooCommerce plugin, the command would be;
wp plugin verify-checksum woocommerce
The files that the core verify checksum or the plugin verify checksum commands in WP-CLI will display will be any of the non-standard PHP or other files that should not exist in WordPress folders. The files should be deleted (it’s always a good idea to take backups before deleting data from your server). and then you can rerun the same verify checksums commands to check that there are no other files which should not exist on your site server.
Knowing how to verify the checksums of WordPress core files, all plugins installed from WordPress.org, and specific plugins installed from WordPress.org using simple-to-use WP-CLI commands will give you peace of mind in knowing that there are no non-standard files that exist in those folder directories.
What is a Redirect?
A redirect is a web server function that will redirect traffic from one URL to another. Redirects are an important feature when the need arises. There are several different types of redirects, but the more common forms are temporary and permanent. In this article, we will provide some examples of redirecting through the vhost file, forcing a secure HTTPS connection, redirection to www and non-www as well as the difference between temporary and permanent redirects.
Common Methods for Redirects
Temporary redirects (response code: 302 Found) are helpful if a URL is temporarily being served from a different location. For example, these are helpful when performing maintenance and can redirect users to a maintenance page.
However, permanent redirects (response code: 301 Moved Permanently) inform the browser there was an old URL that it should forget and not attempt to access anymore. These are helpful when content has moved from one place to another.
How to Redirect
When it comes to Nginx, that is handled within a .conf file, typically found in the document root directory of your site(s), /etc/nginx/sites-available/directory_name.conf. The document root directory is where your site’s files live and it can sometimes be in the /html if you have one site on the server. Or if your server has multiple sites it can be at /domain.com. Either way that will be your .conf file name. In the /etc/nginx/sites-available/ directory you’ll find the default file that you can copy or use to append your redirects. Or you can create a new file name html.conf or domain.com.conf.
The first example we’ll cover is redirection of a specific page/directory to the new page/directory.
Temporary Page to Page Redirect
# Temporary redirect to an individual page
rewrite ^/oldpage$ http://www.domain.com/newpage redirect;
Permanent Page to Page Redirect
# Permanent redirect to an individual page
rewrite ^/oldpage$ http://www.domain.com/newpage permanent;
Permanent www to non-www Redirect
# Permanent redirect to non-www
rewrite ^/(.*)$ http://domain.com/$1 permanent;
Permanent Redirect to www
# Permanent redirect to www
rewrite ^/(.*)$ http://www.newdomain.com/$1 permanent;
Sometimes the need will arise to change the domain name for a website. In this case, a redirect from the old sites URL to the new sites URL will be very helpful in letting users know the domain was moved to a new URL.
The next example we’ll cover is redirecting an old URL to a new URL.
Permanent Redirect to New URL
# Permanent redirect to new URL
rewrite ^/(.*)$ http://newdomain.com/$1 permanent;
We’ve added the redirect using the rewrite directive we discussed earlier. The ^/(.*)$ regular expression will use everything after the / in the URL. For example, http://olddomain.com/index.html will redirect to http://newdomain.com/index.html. To achieve the permanent redirect, we add permanent after the rewrite directive as you can see in the example code.
When it comes to HTTPS and being fully secure it is ideal for forcing everyone to use https:// instead of http://.
Redirect to HTTPS
# Redirect to HTTPS
server_name domain.com www.domain.com;
return 301 https://example.com$request_uri;
After these rewrite rules are in place, testing the configuration prior to running a restart is recommended. Nginx syntax can be checked with the -t flag to ensure there is not a typo present in the file.
Nginx Syntax Check
If nothing is returned the syntax is correct and Nginx has to be reloaded for the redirects to take effect.
service nginx reload
For CentOS 7 which unlike CentOS 6, uses systemd:
systemctl restart nginx
Redirects on Managed WordPress/WooCommerce
If you are on our Managed WordPress/WooCommerce products, redirects can happen through the /home/s#/nginx/redirects.conf file. Each site will have their own s# which is the FTP/SSH user per site. The plugin called ‘Redirection’ can be downloaded to help with a simple page to page redirect, otherwise the redirects.conf file can be utilized in adding more specific redirects as well using the examples explained above.
Due to the nature of a managed platform after you have the rules in place within the redirects.conf file, please reach out to support and ask for Nginx to be reloaded. If you are uncomfortable with performing the outlined steps above, contact our support team via chat, ticket or a phone call. With Managed WordPress/WooCommerce you get 24/7 support available and ready to help you!
What is WooCommerce?
WooCommerce is a WordPress based plugin used by many small to medium sized businesses for building, tracking and maintaining an easy to use e-commerce solution. Because WooCommerce is updated regularly with new releases, online sellers can add new and existing features frequently, along with resolving any known bugs or security vulnerabilities. WooCommerce is actively installed on over 4 million WordPress sites and is used to drive e-commerce sales on a significant number of websites.
Continue reading “Resolving WooCommerce Plugin and Theme Issues”
Want to clean up your WordPress site without having to add multiple plugins? By using WP-CLI, you can run many useful commands to helpfully clean up your database and elements related to your site. In this post, many of the most common tasks are covered:
- Purging Cache
- Regenerate Thumbnail Images
- Deleting Spam Comments
- Removing Temp Data from Database
- Optimizing a Database
- Deleting Posts in Trash
- Deleting Posts in Draft Status
- Delete Posts With Revisions
WP-CLI makes it very easy to rollback plugins and themes as well as update plugins and themes on sites all from command line. This is useful if you see your site is broken by a newer version of the theme or plugin. In this article, we’ll be running through some valuable commands for rolling back your site.
If you need to rollback a plugin on a site to a previous version, you can find the previous version number from the development tab of the plugins listed on WordPress.org. To find the slug of the plugin, you will need to go to the WordPress.org plugins. In the case of Contact Form 7, the plugin slug is contact-form-7.
Rollback a Plugin to a Previous Version
If you need to test that the command is correct, you can always use the flag –dry-run at the end of the command:
In the following example, to rollback Contact Form 7, you can use this command:
Activate A Particular Version of a Plugin
If you need to install and activate a previous version of a plugin, run:
Update All Plugins
If the plugins you updated have been fixed and you now need to update all plugins, the example command is:
Excluding A Plugin
If you want to update all plugins, but need to exclude a specific plugin (in this case WooCommerce), run command:
Rollback a Theme to a Previous Version
Update Theme to Current Version Release
If you know wanted to update the Storefront theme on a site to the most current version, you could use this command example;
Using a mix of these WP-CLI commands will enable you to easily rollback a plugin on your site, rollback a theme, or update all plugins. It will also update all plugins, but exclude a specific plugin from being updated. Our Managed WordPress product comes with WP-CLI installed along with easy, automatic updates. Check out how our Managed WordPress platform can streamline your work today!
WP-CLI is a very handy set of commands. You can run anything that you would run in wp-admin on a WordPress site but from the command line. Useful commands which WP-CLI employs to keep WordPress core updated plugins including the default themes which come with WordPress.
We have collected some of the most common questions that customers ask about our Managed WordPress Hosting platform and housed them in one place.
- How can I access the file manager?
- How do I make a site live?
- How do I make a staging/development site?
- How do I take the staging/development site live?
- What is a stencil and how can I use it?
- How can I increase my PHP limits?
- Why didn’t my plugins update?
- I migrated my site, but I only see the default install. What’s going on?
- What cache plugin should I use to speed up my site?
WordPress is open source software for building unique and powerful websites! It is quickly becoming the easiest and most popular way to create blogs, business sites, portfolios, forums, memberships, and e-commerce websites. Continue reading “An Overview of Managed WordPress”