wordpress

WordPress use CDN with out plugin

Content Devlivery Network (CDN) allow your web site to serve images from another domain or a sub domain. This speed up web site as your web server don’t need to serve images. Also browsers have a limit on number of parallel downloads from same domain. Having images on a differnt domain bypass this limitation of web browser.

If you use a pull type CDN or a CDN that you manually upload using some sync tool, you need to rewrite all image url to CDN url. There are several plugins available to do this. But you can easily do this with out any plugins.

Edit file

Add following code to end of the file.

This will replace image urls with CDN url.

WordPress Avada theme icon missing

WordPress Avada theme load fontawesome from old site

I have migrated a web site using Avada WordPress theme.

Once site is migrated, i edited wp-config.php file and added following to avoid site getting redirected to old website url.

Now site works, but some of the resources are loaded from OLD site url, this breaks some of the icons.

WordPress Avada theme icon missing

On Browser Developer tool console, it show following errors

Using URL replacement plugins like Better Search Replace or Velvet Blues Update URLs did not fix the problem.

To fix the it, login to wp-admin. Click on “Avada” on left menu, select Theme Options

wp-admin > Avada > Theme Options > Import/Export

Under Export Options, click on “Download Data File”, this will ask you to save theme configuration file as a .json file, for me it saved fusion_options_backup_02-08-2019.json.

Next click on “Import Contents from File” button. It will show a text area, paste content of the json file you downloaded in previous step here and click “Import”. This will fix the problem related to fonts loading from old url.

WordPress CLI

To install WordPress CLI, run following command

To list all users in wordpress, run

To create an Administrator user, run

wordpress

WordPress debug

If you have a wordpress web site that give blank screen, you can add following to wp-config.php to enable displaying errors.

This should be added above line

wordpress

Ubuntu Apache Setup for WordPress

On a Fresh Ubuntu 18.04 server, run following commands to setup Apache, PHP and MySQL needed for WordPress installation.

You can go to each file and manually run the commands if you want to see what commands are executed.

At this stage, you have LAMP server setup and ready to go.

To get your domain work with Apache, first you need to point your domain to server IP. This can be done by editing DNS records with your domain registrar or DNS provider.

In commands below, replace

DOMAIN.COM = replace with your actual domain name
USERNAME = you can use any username you wnat, first 8 chars of domain name for example

Create SFTP User

Set a password for the user. This will be used to login to SFTP

You will be asked to enter password 2 times.

Configure Apache

First lets make Apache run as the user, this will make WordPress upgrade easier.

Create Apache VirtualHost entry

Add

To activate the web site, run

Create document root and set permission

Restart Apache

Create MySQL Database

Login to mysql, on ubuntu, as user root, run

Now you will be in MySQL command promt, run following 2 commands to create a Database and User.

Replace MYSQL_PASSWORD with your own MySQL password. DB_NAME with name of database you need. DB_USER with username for the db.

You will need these when installing WordPress.

Installing LetsEncrypt

First install letsEncrypt with

To get SSL for your domain, run

Replace [email protected] with your actual email address.

Installing WordPress

You can now SFTP/SSH into the server. Upload WordPress into html folder. Make sure you use the newly created USER to do this, if you do it as user root, you will get permission error. Visit the web site, you wil get WordPress install wizzard. Just fill the form to do the install. You will need to enter MySQL login details you created before.

Install WordPress using SSH

First login with SSH user you created with command

You will be asked to enter password. Enter password you created before.

Download wordpress

Extract wordpress files with

This will create a folder “wordpress” with the files.

To make the site live, we need to replace folder html with this new wordpress folder

Now you can go to the site, you will see wordpress install screen.

Install WordPress in Kubernetes

To install WordPress in Kubernetes, you need to install helm package manager.

Now run

After the helm chart is run, you will get commands to get login for WordPress admin area.

Here is services it create

List of all pods

Deployments

To scale the deployment, run

See Helm Kubernetes Package Manager, Kubernetes

wordpress

WordPress Backup and Migration Plugins

Migrate Guru: Migrate & Clone WordPress Free

This plugin allow you to transfer your wordpress web site to another hosting for free. It support sites upto 200 GB in size. Use BlogVault to do the transfer.

https://wordpress.org/plugins/migrate-guru/

All-in-One WP Migration

This free plugin allow you to backup and restore your wordpress site. Free version support sites upto 500 MB. If your site is larger, you need to use paid version of this plugin.

To remove 500 MB limit, edit file

Find

Replace with

https://wordpress.org/plugins/all-in-one-wp-migration/

wordpress

WordPress CherryFramework lessphp fatal error

On a WordPress site using CherryFramework based theme, was getting following error.

This was due the web site have migrated to a new server and the path in new server was differnt than old server.

To fix, edited file

On line 157, you see following code

Replace ith with

You will be able to login to wordpress admin area. Once you logged in, go to theme settings and just update, this will update the paths. Now you can remove the change you done in less-compile.php

Change WordPress URL

Method 1: Editing MySQL backup

To change WordPress site url, backup your MySQL database.

Run sed command to replace the URL in MySQL backup file.

Restore the new db-modified.sql, that will have the database with URL changed.

Method 2: Using Plugin

Edit your wp-config.php and add following line.

if you want site avialble on multiple URL

You can also edit the wp_options table

Now you need to use some wordpress plugin to change URL in database, here are some useful plugins for changing site url.

See WordPress