Best Practices For Changing Your Email Marketing Provider

Reading Time: 3 minutes

If you are using one of our Managed application platforms like ManagedWooComerce or Managed WordPress, now may be an optimal time to look into switching your email provider to a different service.

managed email

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. 

Continue reading “Best Practices For Changing Your Email Marketing Provider”

Increase WooCommerce product variation limit

Reading Time: 1 minute

How can I increase the number of default product variations in WooCommerce?

A WooCommerce variable product is a standard product type which allows you to offer a group of variations (different sizes, colors, prices and so on) in a product to your customer. This simply means that it shows a wider array of attributes which your customers can choose from.

In order to modify this setting, SSH into the server and open your functions.php file located here:

/wp-content/themes/YOUR_THEME/functions.php

Now, let’s modify the variable:

Constant – WC_MAX_LINKED_VARIATIONS

vs

Filter – woocommerce_ajax_variation_threshold

How To Delete Post Revisions using WP-CLI

Reading Time: 2 minutes

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:

cd html

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:

gzip sitebackup.sql

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.

How To Verify WordPress Checksums Using WP-CLI

Reading Time: 2 minutes

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).

Getting Started

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.

Checksums Commands

  • 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

Summing Up

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.

How to Migrate from Shopify to WooCommerce

Reading Time: 3 minutes

Shopify is a hosted e-commerce platform which can make setting up a store easy for most customers. Unfortunately, Shopify can get expensive when you need to scale up, plus there is a cost per transaction for each order. WooCommerce is an open plugin which can be installed on your existing WordPress site which, along with other plugins, will turn your store into a fully fledged eCommerce store. You can also get a fully-managed WordPress/WooCommerce store with Liquid Web’s Managed WooCommerce Product.

If you did start your store on Shopify, but you now want to migrate to using WooCommerce, you’ll need to export your existing store data, customers, orders and products out from Shopify and then import all of that data into your new WooCommerce store.

Step #1 – Export your Data from Shopify

Shopify does have help posts which cover customers, orders, and products and how you can export those each out to CSV files.

Step #2 – Import Your Data into WooCommerce

Now that you have the store data, how do you get that data imported into your WooCommerce store? WooCommerce does have a native CSV importer for products which can be of use, but it has certain limits. If you have to import a number of CSV files, you’ll need to map each of the fields in the CSV for each part of the product import (like the product title and product SKU, for instance). To import a CSV file, go to WooCommerce > Products and select Import. Choose the CSV file, confirm all of the field mapping, then run the importer.

woocommerce import/export screenshot

Alternative – Use WP All Import

If you’d rather not manually map all of the fields for each import, there is an excellent paid plugin for WordPress which will allow you to import in customers, orders, and products. It’s WP All Import and has add-on plugins for users and WooCommerce. The WooCommerce add-on will allow you to import products, and orders and the user’s add-on will allow you to import in customers. You’ll need to purchase and install the WP All Import plugin to proceed with these directions.

To make the process easier WP All Import allows you to create templates. Since we are importing products in this article, we’ve created a template to map all of the product fields for a product import. To import products using this template, save this template as a TXT file.

Open the plug in and go to All Import > Settings. In the Import/Export Templates section, select the text template file and import it. After the template file has been imported correctly, you will see there is now a template file.

import template screenshot

To import your product CSV export from Shopify in WP All Import go to All Import > New Import.  Select the CSV file and then select New Items and select the  WooCommerce Products type.

continue to step 2

Confirm the number of rows to imported and then continue to Step 3.

number of rows to be imported screenshot

Scroll to the bottom of the page, and select Load Template. Next, select the Shopify product template. This indicates that all fields in the CSV have been mapped correctly to import products into WooCommerce.

Now you can continue and all products which were exported from the Shopify store will be imported into WooCommerce. The images used on the store on Shopify will be imported into the store’s media library during the import, and then mapped into the product. The products will contain the correct data, as well as the featured image.

Customers and orders can also be exported from Shopify as CSV files. Customers can be imported using WP All Import Pro, with the user’s add-on, and orders can be imported using the WP All Import Pro Woocommerce add-on. This only covers retrieving the data from Shopify, then importing into WooCommerce. The theme used on the Shopify store can not be used, but you can replicate the look of the store by using a solid combo of Astra as the theme, then add any specific landing page elements using Beaver Builder page builder.

How To Bulk Delete Pending Payment Orders from Managed WooCommerce Hosting

Reading Time: 2 minutes

There may be times when bulk deleting orders becomes necessary, such as orders which have been moved to the trash, or orders with the status of payment pending on a store. Deleting orders from wp-admin can be a slow, tedious process, even if you increase the number of orders that load at one time from the default value of 20 in the screen options.

This is where using the WP-CLI comes in handy, using the wp post delete command (for detailed directions on this command, see wp post delete).

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).

  1. Log in, then enter:

cd html

This will change the directory to the html directory where you can run the WP-CLI commands.

  1. To create a database backup before bulk deleting pending payment orders, run this command;

wp db export

  1. You can use the gzip compress down the resulting sql file.

gzip sitebackup.sql

Cleaning Up Your Pending Orders

  1. To completely delete only orders which have a post status of wc-pending, using this WP-CLI command;

wp post delete $(wp post list --post_type='shop_order' --post_status=wc-pending --format=ids --force)

  1. If you do not want to skip moving those orders to the trash, you can run this command;

wp post delete $(wp post list --post_type='shop_order' --post_status=wc-pending --format=ids)

  1. To delete any orders which have been moved to the trash, essentially “emptying the trash folder”, run this command;

wp post delete $(wp post list --post_type='shop_order' --post_status=trash --format=ids --force)

Using the WP-CLI command will be a much faster method than trying to manually bulk delete those orders from wp-admin on the site, saving you time to spend on the real work of running your business. See our website for more information about our Managed WooCommerce Hosting.

How to Redirect URLs Using Nginx

Reading Time: 3 minutes

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.

Note
As this is an Nginx server, any .htaccess rules will not apply. If your using the other popular web server, Apache, you’ll find this article useful.

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.

Note
If you choose to create a new file be sure to update your symbolic links in the /etc/nginx/sites-enabled. With the command:

ln -s /etc/nginx/sites-available/domain.com.conf /etc/nginx/sites-enabled/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

server {
# Temporary redirect to an individual page
rewrite ^/oldpage$ http://www.domain.com/newpage redirect;
}

Permanent Page to Page Redirect

server {
# Permanent redirect to an individual page
rewrite ^/oldpage$ http://www.domain.com/newpage permanent;
}

Permanent www to non-www Redirect

server {
# Permanent redirect to non-www
server_name www.domain.com;
rewrite ^/(.*)$ http://domain.com/$1 permanent;
}

Permanent Redirect to www

server {
# Permanent redirect to www
server_name domain.com;
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

server {
# Permanent redirect to new URL
server_name olddomain.com;
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

server {
# Redirect to HTTPS
listen      80;
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

nginx -t

If nothing is returned the syntax is correct and Nginx has to be reloaded for the redirects to take effect.

Restarting Nginx

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!

Resolving WooCommerce Plugin and Theme Issues

Reading Time: 3 minutes

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”

Delete Posts and Comments from Action Scheduler

Reading Time: 2 minutes

The Action Scheduler is a background processing, queue job runner which is built into WooCommerce core. A number of plugins use the Action Scheduler, WooCommerce Subscriptions and WooCommerce Follow-Ups being two of the best known.

WP-CLI makes it easy to delete posts and comments which have been created by the Action Scheduler in WooCommerce. There may be cases where the Action Scheduler might create a large number of posts and comments on your live site, and you want to clear up the data from the site’s database.

 

Delete Comments from Action Scheduler

To delete comments created by the Action Scheduler, you can run this command:

wp comment list --field=comment_ID --'post_author'='ActionScheduler' --number=1000 | xargs wp comment delete --forceThe number can be increased if you have more comments that need to be deleted to 2000 or higher.

Delete Bulk Posts from Action Scheduler

To delete all of the scheduled-action posts, you can run this command:

wp post list --field=ID --post_type=scheduled-action --posts_per_page=1000 | xargs wp post delete --forceThe number can be increased if you have more posts that need to be deleted to say 2000 or higher.

Delete Scheduled Action Posts

To delete all of the scheduled-action posts with a post status of trash, you can run this command:

wp post list --field=ID --post_type=scheduled-action --posts_per_page=1000 --post_status=trash | xargs wp post delete --force

Delete Bulk Scheduled Actions

To delete all of the scheduled-action posts with a post status of cancel,  you can run this command:

wp post list --field=ID --post_type=scheduled-action --posts_per_page=1000 --post_status=cancel | xargs wp post delete --force

 

Using a mix of these commands, you will be able to delete posts and comments easily, using WP-CLI on your site. It will also keep your site database clean, allowing it to run more efficiently.  Take the work out of maintaining your WordPress site with our Managed WooCommerce product.  Our WooCommerce platform comes with free iThemes plugins curated especially for online stores.

8 WP-CLI Commands to Clean Up and Optimize your Site

Reading Time: 2 minutes

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:

Continue reading “8 WP-CLI Commands to Clean Up and Optimize your Site”