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

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.

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

Running wp-cron with cronjob

By default wordpress run cronjob everytime user visit your web site. This is bad idea for busy site.

To run wp-cron with cronjob, first edit wp-config.php and add following

Now set cronjob.

if you have wp-cli installed, use following cronjob

If you don’t have wp-cli installed, use

Replace /var/www/html to actual folder where your wordpress installation is located.

Disable bitnami banner from wordpress

To remove logo from bitnami wordpress, login to SSH as user “bitnami”, then run

Now restart web server

If you are using Nginx, run

WordPress bitnami
Install LetsEncrypt SSL on Bitnami

Enable Amazon Cloudfront CDN in WordPress

I was setting up a wordpress web site to use Amazon S3 + Cloudfront as CDN. I used w3 total cache plugin for this. w3 total cache plugin have option to auto create Amazon S3 bucket and cloudfront distribution, for for this, you need to give Amazon AWS API keys.

WordPress CDN Setup W3 Total Cache

Clicking the button “Create as new bucket with distribution” will auto create s3 bucket and cloudfront for you.

if you site have images already uploaded, you need to upload them to Amazon S3. This can be done with W3 Total Cache.

Upload WordPress media to CDN

If you have lot of files, upload may fail. You may need to use Amazon AWS CLI tool to do the upload.

If needed, you can upload themes and plugins folder too

Disable WordPress wp-cron.php

WordPress run its sheduled tasks using wp-cron.php, this get called every time visitor visits web site. This is not efficient method for high traffic web sites. Since this have to be loaded using web server, it can cause web server process hang if your cronjob take more time to finish. It is better disable wordpress cronjob and set a real cronjob.

To disable wordpress cronjob, edit wp-config.php file, add following

Now set a cronjob as follows