3

I have the latest, version 3.1.2 and have multisite installed. I have debug on true for testing purposes. I get the follow error when I install plugins.

Where and how do I fix this?

Error: 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 instead. in /home/mysite/public_html/wp-includes/functions.php on line 3387

thanks in advance!

1
  • 1
    A Plugin is using a deprecated function and/or function argument. You should file a bug report with the Plugin developer. WPSE shouldn't be used for reporting bugs. Commented Aug 5, 2011 at 14:43

3 Answers 3

2

You are fine , its the plugins who are bad! some plugins have not been updated and are still using User level as capability when adding menu pages instead of capability, for example

 10 = manage_options = admin

take a look at this thread to understand better.

1
  • yes, that's right I just disable one by one of my installed plugin. so I can seek and find that plugin (that use the wrong level as the capability). when the log is enabled there is 4 error on top of the wp-admin page. I search and find your reply then disable and found the deprecated plugin and revert back all those good plugins. everything ok now. thanks Commented Oct 2, 2018 at 20:48
1

for anyone who meets this issue, you can fix it by changing the parameter of add_options_page like this:

       add_options_page(__('WP Flickr Embed', 'wp-flickr-embed'), __('WP Flickr Embed', 'wp-flickr-embed'), 8, $this->pagesDir.'/admin.php');
       add_options_page(__('WP Flickr Embed', 'wp-flickr-embed'), __('WP Flickr Embed', 'wp-flickr-embed'), 'manage_options', $this->pagesDir.'/admin.php');

Change the number parameter to 'manage_options' if its 8. For other number, you need to do a search.

https://github.com/travisseitler/wp-flickr-embed/commit/d3b03191061e46f4850dce407bb55cf5161c5380

0

Yes, there are two places to check for this error -- one is when adding a menu / page as in 'add_options_page', and the other is when explicitly checking the capability with current_user_can and its like.

Also, a plugin should not use roles -- it should use capabilities. So for the function I just mentioned 'add_options_page', the capability is probably 'manage_options'.

Roles are for the user to have, which are a grouping of capabilities.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.