Today, most of the website, we read and seen are powered by Content Management System like WordPress, Joomla, Drupal, TYPO3… but on this post we only focus the widely-used “CMS” WordPress.
WordPress is a free and open-source content management system (CMS) built with PHP and MySQL. Here at Casting Data currently in WordPress 4.9.4, I forgot to update the latest version which is WordPress 4.9.8.
Recently, Casting Data encountered a major problem, Can’t edit all posts and it can’t also update WordPress to latest version, just before this post published Casting Data is using WordPress 4.9.4 and forgot to update to the latest version of WordPress.
Sadly, I forgot to update the system to the latest version which WordPress 4.9.8 as of September 2018, this was happening because I have Installed “Disable All WordPress Updates” plugin and whenever there is a new release, it must deactivate for a while and update to latest release. Unlike those websites don’t have “Disable All WordPress Updates” installed it will automatically update whenever there is a new WordPress Version.
Common Problems we encounter using WordPress
- WordPress White Screen
- Cannot “Deactivate or Activate” all plugin
- Cannot Update or Edit Post
- Broken WordPress Homepage
- Operation not allowed when innodb_forced_recovery > 0
But now whenever I click the “Deactivate” link under “Disable All WordPress Updates” it will just prompt a message above with “Plugin deactivated” but you can see the plugin is not deactivated.
Also, clicking Activate button will only prompt Plugin Activated but refreshing the browser the plugin still not activated.
Important: Backup All Files and Database
Way back 2 years ago when I’m still working as a Backend Engineer and Web Developer using WordPress, whenever we found a bug or misbehavior in WordPress, we usually do these 5 things step by step.
- set define(‘WP_DEBUG’, true) in wp-config.php
- Check error_log in the root directory
- renamed the folder plugin under wp-content directory to anything like “pluginssss or xxxxx”
- or Directly disable the plugins in the database.
- Manually Update Wordress
1. Setting define (‘WP_DEBUG’, true)
This is the first option to do when having trouble with your WordPress Content Management System by default wp-config.php don’t have this code, so you must add this manually inside the wp-config.php, after adding this code you can see a lot of code usually a “NOTICE” displayed on your website.
<?php
define('WP_DEBUG', true);
define('DB_NAME', 'dbname');
define('DB_USER', 'dbuser');
define('DB_PASSWORD', 'dbpass');
define('DB_HOST', 'dbhost');
define('DB_CHARSET', 'utf8');
define('DB_COLLATE', '');
define('AUTH_KEY', '|Qj:@e-)msxelM?jq%=OUEwHNJX-An-?zHL>.+zb4]Vr#th0[Vl7&D7hQL[rm1zO');
define('SECURE_AUTH_KEY', '8+%aE)}=Yd?^F~H%,$p.5~?cS%kUrulT%+E1@e.|#MqSWfcj18u4s3X>h<8mn*UU');
define('LOGGED_IN_KEY', 'U ?BYF0h#4k5t|Gfb6%YeK# 2`*;34dGxaUa&a.Qd1zS$w~zSo-%sQs9u-MP|-hr');
define('NONCE_KEY', '2To)Vs;{I~S!;]rp6O;BNo8$5!sjDG47R{q^Ev)k2JJalX1@hQ)bx&h:bTF-aW<Z');
define('AUTH_SALT', 'X4OF[*O.jn#d7.5!(V_+n17;*~zIW&$p.#TMZW+7+BD|+Gr|]?[< 20~o)i1r!h38);
define('SECURE_AUTH_SALT', '1t6Z5mcN2lyp3<E;,JRM<)}-k97Q+8s6B4#Gl>)5-1&pI(inEVDvH%@|0|jq8ZEe');
define('LOGGED_IN_SALT', '~]GbybZy5TWU>6L]cr$-;he^kaY_y!j|n-i{};UJDuK; Q-W[8^_*_!HYx)x#<R;');
define('NONCE_SALT', 'J~K3&kS(h@wcKep~T`@j:]6Q+)zRB:MtIll-||Jrov!-Y$-KPpt+030zfjNy%^#Z');
?>
After troubleshooting you can disable “define(‘WP_DEBUG’, false)”.
Go to step 2 if step above will not solve the problem.
2. error_log debugging
Usually by default your server will automatically put error_log in the root directory, but if does not follow the steps below.
You can set this settings in wp-config.php
<?php
ini_set("log_errors", 1);
ini_set("error_log", "error_log.log"); // It will create a file name error_log.log
error_log(); // function to display error
?>
You can find a bunch of code in that file just like below.
<p>[08-Jul-2017 11:59:38 UTC] PHP Parse error: syntax error, unexpected '<' in /home/castingdata/public_html/castingdata.com/wp-content/themes/castingdata/loop-single.php on line 38
[08-Jul-2017 11:59:43 UTC] PHP Parse error: syntax error, unexpected '<' in /home/castingdata/public_html/castingdata.com/wp-content/themes/castingdata/loop-single.php on line 38
[18-Jul-2017 04:03:23 UTC] PHP Warning: Cannot modify header information - headers already sent by (output started at /home/unlibytes/public_html/my-website/castingdata.com/wp-content/plugins/seo-ultimate/modules/titles/titles.php:138) in /home/castingdata/public_html/castingdata.com/wp-content/themes/castingdata/page.php on line 24
[18-Jul-2017 04:03:25 UTC] PHP Warning: Cannot modify header information - headers already sent by (output started at /home/unlibytes/public_html/my-website/castingdata.com/wp-content/plugins/seo-ultimate/modules/titles/titles.php:138) in/home/castingdata/public_html/castingdata.com/wp-content/themes/castingdata/page.php on line 24
[17-Aug-2017 19:00:05 UTC] PHP Warning: Cannot modify header information - headers already sent by (output started at /home/unlibytes/public_html/my-website/castingdata.com/wp-content/plugins/seo-ultimate/modules/titles/titles.php:138) in /home/castingdata/public_html/castingdata.com/wp-content/themes/castingdata/page.php on line 24
</p>
You can edit this file on what the error and warning displayed in that file, if this step will not satisfy what you need go to step 3
3.Renaming plugins Folder
This also another way of troubleshooting if there are some plugins are deprecated or will not run in the current CMS version. This can be done easily by logging in your CPANEL and locate your website files and rename the plugins folder under /domainname/wp-content/plugins like /domainname/wp-content/pluginsxxxxxxx. After that you can see the result if the plugins are the one causing the problem.
Go to step 4 if both steps 1,2 and 3 will not solve the problem.
4. Directly disable the plugins in the Database
Note: please backup all database data or just the active plugins field
You can locate this inside “table_prefix_options” in my case it is xxxxx_options under active_plugins and leave it blank. It will also fix WordPress Problem.
See below for the value of active_plugins.
exclude the p tag
<p> a:3:{i:1;s:45:"disable-wordpress-updates/disable-updates.php";i:2;s:32:"login-lockdown/loginlockdown.php";i:3;s:29:"seo-ultimate/seo-ultimate.php";}
</p>
replace the option_value with
<p> a:3:{ } </p>
this means no plugin installed in your new WordPress version.
But not in this case, as I empty the active_plugins data, the system will not allow empty active_plugins fields.
Finally, if 4 mentions above will not solve the problem you can finally do a Manual WordPress Update.
5. Manually Update Wordress
You can do this by downloading the latest version of WordPress, after downloading extract the zip files.
Copy the uploads and themes folder under /wp-content/ directory.
So you have a new WordPress files now so don’t forget to rename the “wp-config-sample.php” to “wp-config.php” and update the values in your wp-config.php
<?php
define('DB_NAME', '');
define('DB_USER', '');
define('DB_PASSWORD', '');
define('DB_HOST', '');
?>
and match the table_prefix_options in your previous wp-config.php files
There you have it solved the Problem and now Casting Data will always be updated to the latest version as long as there is a new release.
Disclaimer: The view and opinions expressed in this blog post are that of the author and do not in any way represents the agency or department he/she currently belongs to. Further, this information should not be interpreted as an endorsement of any specific provider, service or offering.