Fixed: Wordpress Visual Post editor not working issue

Hi everyone as always I will cut the crap and come straight to point.

I got the task to fix a site and for that I created a new user from backend using phpmyadmin using the following command as the owner of site had forgotten the password for wp-admin:
INSERT INTO `wpdatabasename`.`wp_users` (`ID`, `user_login`, `user_pass`, `user_nicename`, `user_email`, `user_url`, `user_registered`, `user_activation_key`, `user_status`, `display_name`) VALUES ('2', 'Shivam', MD5('demopass'), 'Shivam', 'test@yourdomain.com', 'http://www.test.com/', '2019-05-16 00:00:00', '', '0', 'Shivam');
INSERT INTO `wpdatabasename`.`wp_usermeta` (`umeta_id`, `user_id`, `meta_key`, `meta_value`) VALUES (NULL, '2', 'wp_capabilities', 'a:1:{s:13:"administrator";s:1:"1";}');
INSERT INTO `wpdatabasename`.`wp_usermeta` (`umeta_id`, `user_id`, `meta_key`, `meta_value`) VALUES (NULL, '2', 'wp_user_level', '10');
Now the problem was this new user for some reason was not able to access wordpress visual editor or block editor while creating new posts the only thing which was visible was this which looks like code editor being set by default:

No other options in settings to select visual editor nothing.

Now the solution part:

How I found where the problem was:
I created a new admin user from wordpress backend logged out of current user session which was having issues and logged back in with the new account that I just created, went ahead and tried to create new post and for this user it worked fine.

What does that mean ?
So that means that the problem was with the user and not with any wordpress config file configurations.

Now what exactly the problem was?
I went back to phpmyadmin and executed the following queries on my wordpress database:
Note:Check your wp-config.php file if you dont what's the name of your wordpress database

  • To find the Id of user having this issue execute this SQL on table wp_users:
SELECT * FROM `wp_users`;

  • Note down the ID's of the user from results that gets returned.
  • In my case ID for user with problem was 2 and the one which was working fine was 3.

Next run this SQL on table wp_usermeta :
SELECT count(*) FROM `wp_usermeta`  where user_id=2;
SELECT * FROM `wp_usermeta` where user_id=2;
SELECT count(*) FROM `wp_usermeta`  where user_id=3;
SELECT * FROM `wp_usermeta` where user_id=3;
Compare the rows returned here is what you will notice:

  • The total number of rows that got returned for the newly create admin user from wordpress backend was 15
  • Whereas for the one that was created from phpmyadmin it was 28
  • (But this count doesn't matters as it can be different for you based on some plugins installations then what its for mine)
  • The thing that matters are the following 2 rows in-fact the one which says rich_editing is the important one and guess what, this was missing from usermeta for user that was created using phpmyadmin.




Solution:

INSERT INTO `wp_usermeta` (`umeta_id`, `user_id`, `meta_key`, `meta_value`) VALUES (NULL, '2', 'rich_editing', 'true')

So to solve this I inserted a new row manually in the wp_usermeta table by executing the above SQL query(don't forget to replace the ID with the ID of user having issues where it says 2 in query) and logged back in to wordpress admin with user account that was having problem earlier, tried adding new post and this time the visual post editor was available and working fine.


Problem solved! I hope this helps as there was nothing much I got on googling for solution.

Comments

Popular posts from this blog

Adding Home Older Newer Post Buttons in new Blogger templates such as Contempo

Adding copy to clipboard button to every google code prettify pre blocks in blogger

Checklist: Before applying for adsense