How to Fix “ has_cap was called with an argument ” Error in WordPress

On logging to my WordPress Multisite account and visiting the admin panel, I always found following error (described in the next para) greeting me.

I tried my all possible avenues to resolve the problem but it was all in vain. There was a total absence of any viable material on the internet to deal with such problem.

I knew that the error ‘has_cap was called with an argument that is deprecated‘ was being caused by some faulty plugin. But usual troubleshooting of disabling one by one all the plugins and then checking it, could not bring any fruitful result. This was one of the many Nagging Problems, I faced after Changing from Blogger to WordPress.

“Notice: has_cap was called with an argument that is deprecated since version 2.0! Usage of user levels by plugins and themes is deprecated. Use roles and capabilities /home/explojcr/public_html/wp-includes/functions.php on line 4021”

Recommended for you:
SEO Optimization for Post by Using Tags
How to Defer Parsing of JavaScript in WordPress

After a week of desperation and futile trouble shooting, I came across an article which talked about turning ON the Debugging option to TRUE by visiting the wp-config.php file. In this case, the user was not able to login to his WordPress control panel. This gave me a clue to look for the option in my wp-config.php file. I found that the ‘WP_DEBUG’ option was already turned to true. I sensed a dim light of a probable solution. When I changed the DEBUG option to false, the said error was gone from my control panel. It filled my heart with profound satisfaction. So here is the brief of various steps that I took to resolve the issue.

Resolution for ‘has_cap was called with an argument that is deprecated’ error:

  • Go to your cPanel and browse for /home/explojcr/public_html.
  • Find wp-config.php file
  • open it by right clicking it and selecting the edit option.
  • Now using Ctrl + F option find for the line define(‘WP_DEBUG’,
  • Change define(‘WP_DEBUG’, true); to define(‘WP_DEBUG’, false);
  • Save the file.
  • By now the error will be gone.

Please be aware that by turning off the DEBUG option, you are hiding the WordPress errors from being displayed. Many times it happens that different plugins which are routinely updated, have minor bugs. These bugs cause errors to be displayed which at times are quite nagging to users. There fore you can safely turn the DEBUG option to False.

Hope that your error ‘has_cap was called with an argument that is deprecated‘ has been resolved. If that is so, please drop your comment and apprise us about your experience.  All the best.


Comments are closed.