How to fix WordPress Media error Unable to create directory uploads..

You may face something like the following upon uploading an image using your WordPress –> Media section

Error:

“foto-0012.jpg” has failed to upload.
Unable to create directory uploads/2022/02. Is its parent directory writable by the server?

Fix 1:

Double check you have files/folders permissions 644/755 accordingly

find .
Read the rest

How to fix “no title” issue for just uploaded images under WordPress dashboard

The symptoms are looking as the following:

Not sure how this happened probably because of some media plugin but this occurs under your WordPress –> Media when you’re trying to upload any new picture

Anyway I have fixed it by  altering wp_posts table to make ID as index table and enabled AUTO_INCREMENT as showed below

Detailed steps:

- login your phpMyAdmin
- click your database 
- click wp_posts table (watch your prefix)
- click "Structure" tab
- click "More" to set Index/Primary
- click "Change" to enable A_I (AUTO_INCREMENT)
- click "Save"

Should be going well now.… Read the rest

How to set up SMTP for Office 365 using WordPress plugin Easy WP SMTP

- Install WordPress Easy WP SMTP Plugin
- WordPress --> Settings --> Easy WP SMTP --> SMTP Setting and append the following settings:
- From Email Address : (your email address here)
- SMTP Host : smtp.office365.com
- SMTP Port : 587
- Type of Encryption: TLS/STARTTLS
- SMTP Authentication: YES
- SMTP Username : (your email address here)
- SMTP Password : (your email address password here)
- Click Save.
Read the rest

How to fix a login issue after WordPress Multisite split

The slave installation will lose users

wp user list

+—-+————+————–+————+—————–+——-+
| ID | user_login | display_name | user_email | user_registered | roles |
+—-+————+————–+————+—————–+——-+
+—-+————+————–+————+—————–+——-+

And you won’t be able to create new admin user because you don’t have appropriate MySQL tables

wp user create admin [email protected]
Read the rest

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