admin管理员组文章数量:1406944
Is it possible to block specific plugins from updating, manually too? I don't want to block this by hiding the notification, changing the plugin version or anything like this. I'd like the notification to show, show the new version number, but when hitting the update manually it should block/disallow this - preferably displaying some sort of (cusomized) notification in the plugin section (eg. "Update for this plugin is not possible").
Is it possible to block specific plugins from updating, manually too? I don't want to block this by hiding the notification, changing the plugin version or anything like this. I'd like the notification to show, show the new version number, but when hitting the update manually it should block/disallow this - preferably displaying some sort of (cusomized) notification in the plugin section (eg. "Update for this plugin is not possible").
Share Improve this question asked Nov 26, 2019 at 12:24 Chris OsiakChris Osiak 117 bronze badges 3- if it's a free plugin of wordpress, you juste have to rename the directory name of the plugin. – Kaperto Commented Nov 26, 2019 at 12:38
- I was more looking into commercial plugins. – Chris Osiak Commented Nov 26, 2019 at 15:26
- there is a lot of different way to update a commercial plugin then you have to read the code of the plugin to find how to stop the update. – Kaperto Commented Nov 26, 2019 at 18:01
2 Answers
Reset to default 0Try this:
add_filter( 'http_request_args', 'dm_prevent_update_check', 10, 2 );
function dm_prevent_update_check( $r, $url ) {
if ( 0 === strpos( $url, 'http://api.wordpress/plugins/update-check/' ) ) {
$my_plugin = plugin_basename( __FILE__ );
$plugins = unserialize( $r['body']['plugins'] );
unset( $plugins->plugins[$my_plugin] );
unset( $plugins->active[array_search( $my_plugin, $plugins->active )] );
$r['body']['plugins'] = serialize( $plugins );
}
return $r;
}
Credits: https://stackoverflow/questions/17897044/wordpress-how-to-disable-plugin-update
Assuming you are still planning on updating plugins yourself but don't want other users to be able to do it, according to wp-admin/update.php you can revoke the 'update_plugins' permission from a user to prevent this. They will get a wp_die message 'Sorry, you are not allowed to update plugins for this site.'
For permissions management you can use User Role Editor or similar.
本文标签: phpBlock plugin update possibilities (but not by hiding notifications)
版权声明:本文标题:php - Block plugin update possibilities (but not by hiding notifications) 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744965369a2634915.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论