How to change WordPress site URL and home URL using wp-cli tool

To check site url:

wp option get siteurl

To update your website’s URL:

wp option update home 'https://alltime.pp.ua'
wp option update siteurl 'https://alltime.pp.ua'

This will update to MySQL records “home” and “siteurl

To run in-deep updates read the following article:

https://alltime.pp.ua/blog/how-to-change-wordpress-main-url-to-new-one/Read the rest

How to create a post using wp-cli

Install wp-cli and run something like the following:

wp post create --post_type=page --post_status=publish --post_title='Home' 
wp post create --post_type=page --post_status=publish --post_title='About'
wp post create --post_type=page --post_status=publish --post_title='News'
wp post create --post_type=page --post_status=publish --post_title='Contact'
Read the rest

How to fix “Sorry, you are not allowed to access this page.”

Using WP-CLI

If you see an empty ROLES then it is

wp user list
+----+------------+--------------+--------------------------------+---------------------+---------------+
| ID | user_login | display_name | user_email            | user_registered                | roles |
+----+------------+--------------+--------------------------------+---------------------+---------------+
| 1  | admin1     | admin1           | [email protected] | 2018-06-19 17:00:02 |         |
+----+------------+--------------+--------------------------------+---------------------+---------------+

So add admin right for this user:

wp user set-role 1 administrator

Check it, should be good now:

wp user list
+----+------------+--------------+--------------------------------+---------------------+---------------+
| ID | user_login | display_name | user_email            | user_registered                | roles |
+----+------------+--------------+--------------------------------+---------------------+---------------+
| 1  | admin1     | admin1           | [email protected]
Read the rest

How to change WordPress main URL to new one

Using WP-CLI (preferred):

Enter folder where your WordPress is installed:

username@server1 [~]# cd ~/public_html

Create backup of your database:

username@server1 [~/public_html]# wp db export

The following command won’t do any change because of –dry-run key specified but show you tables and amount of replacement

username@server1 [~/public_html]# wp search-replace 'OLDdomain.com'
Read the rest

How to install templatemonster theme using wp-cli

Upload your template_XXXXX_XXXXXXXXXXX.zip to folder where your WordPress is installed

Unzip template_XXXXX_XXXXXXXXXXX.zip to some temporary folder.

Then find two zip files under temp_extract/theme/ folder and move them to document root directory of your website.

unzip template_XXXXX_XXXXXXXXXXX.zip -d temp_extract
mv temp_extract/theme/CherryFramework.zip ./
Read the rest

How to reinstall broken WordPress plugin using wp-cli

If you cannot execute wp-cli command due to the error generated by one of your plugins

Command:

wp plugin status

Output:

Warning: include_once(/home/username/public_html/subdomains/domain.com/wp-content/plugins/woocommerce/includes/libraries/wp-async-request.php): failed to open stream: No such file or directory in /home/username/public_html/subdomains/domain.com/wp-content/plugins/woocommerce-abandoned-cart/includes/background-processes/wcal-async-request.php on line 3

 

Just use –skip-plugins parameter along with –force

As result you will get:

wp plugin install woocommerce --skip-plugins --force

 … Read the rest

How to fix broken WordPress Elementor plugin

First of all create a backup of your website files/folders/database

cd ~/public_html

Rename broken plugin’s folder:

mv wp-content/plugins/elementor wp-content/plugins/elementor_old

Don’t worry, currently all settings are presaved in your database.

Now do reinstall of the Elementor plugin using wp-cli with –force:

wp plugin install elementor --force

Should be ok now!… Read the rest