I have two wordpress websites.
Both same PHP version. Same WordPress version.
I’ve a user in each that is set to the role “Administrator”.
I’ve made a custom .php file to do some testing.
if ( ! current_user_can( ‘install_plugins’ ) ) {
echo”Current user cannot install plugins! ?:( <br>\n”;
//$current_user->add_cap(“install_plugins”);
}
else{
echo “Current user can add plugins! :)<br>\n”;
}
One says they can.. one says they cannot. I’m weirded out. Also in the plugins admin page the one that cannot add plugins is missing a few options from the bulk updates drop down and if I go to wp-admin/plugin-install.php page directly I get the error:
>” Sorry, you are not allowed to access this page. ”
When I use the following code both sites show the plugin-install capability in the list.
$capabilities = $current_user->caps;
foreach ($capabilities as $capability => $value) {
if ($value) {
echo $capability . “<br>”;
}
}
What could be overriding the current\_user\_can( ‘install\_plugins’ ) check on the site thats returning false?? I don’t think this is database driven. Could this be a hacked file ? Where would I look?
[ad_2]
* Are the sites a replica of each other?
* Do they have the same themes and plugins?
* Have you tried reinstating a working version of the site that isn’t functioning?
* Have you looked into reinstalling WordPress?
* Depending on the plugins you have and whom the site is hosted with, are there any indications/alerts/notifications of anomalous files/activities?