Disallows bad WordPress plugins
Plugin Blacklist helps administrators prevent unwanted WordPress plugins from being used while also flagging plugins that may require review or only temporary activation.
The plugin reads its rules from wp-content/blacklist.txt. Entries under [blacklist] are enforced throughout the WordPress admin area: matching active plugins are deactivated, activation attempts are blocked, and the Plugins screen keeps only a Blacklisted label and the delete action. Matching Install Now buttons are also disabled in the WordPress.org plugin installer, including results loaded through AJAX.
These restrictions do not delete plugin files or prevent plugins from being uploaded by other methods, but matching plugins cannot remain active.
Entries under [graylist] are allowed to remain active but generate an admin warning because they may be prohibited in the future. Entries under [utility] generate an informational reminder to deactivate those plugins when they are not being actively used.
Blacklist entries use prefix matching by default. For example, an entry of plugin-name also matches plugin slugs beginning with plugin-name, such as plugin-name-pro. To target only one exact plugin slug, wrap it in slashes, such as /plugin-name/.
Plugin Blacklist does not use a settings screen, database options, or scheduled jobs. The blacklist file is read directly and cached only for the current request, with admin notices shown when the file is missing, unreadable, or contains no enforced blacklist entries.
- standardized code comments and improved formatting for readability
- added
Tested up to:header set at 6.9 - added
Update URI: falseheader - added
Text Domain: plugin-blacklistheader
- hardened plugin slug normalization for cross-platform filesystem compatibility
- added
Requires PHPplugin header
- improved disabling "Install Now" button on exact match slugs like
/jetpack/
- tweaked disable wordpress.org snippet
- replaced
esc_html()withwp_kses_post()wherever messages are being output in admin notices
- added
ajaxCompletehandler to ensure "Install Now" button is properly disabled even after AJAX events - minor code cleanup and security and performance enhancements
- changed
pbm_enqueue_admin_scriptsaction to priority25to avoid conflicts with Repo Man
- minor refactoring to fix support for exact-match
/plugin-slug/using slashes (without slashes is prefix match only) - tweaks to formatting, comments, etc.
- add
gu_override_dot_org(fixed) snippet
- new global variable
$pbm_blacklist_data - improved
pbm_add_admin_notice()to prevent duplicates
- completely refactored plugin to standard WordPress coding using ChatGPT
- no more cron jobs or database usage
- main blacklist now called
blacklist futureblacklist now calledgraylistpauseblacklist now calledutility- renamed other sublists to:
blacklist classes,blacklist functions,graylist classes,graylist functions,utility classes,utility functions - blacklisted plugins force deactivated on each WP Admin page load via
initif activated (no longer uses cron jobs for this check) - new feature to gray out blacklisted plugins in the plugin search
- new featured to disable blacklisted plugins action links and replace with the word "Blacklisted"
- trying to circumvent using drop-down menu Activate or direct URL are sent to
wp_die - enhanced code for PHP 8.3
- compatible with PHP 7.0, 7.2, 7.4, 8.1
- support for Git Updater (although this is meant to be a MU plugin only)
- admin notices code play (incomplete)
- abandoned version
- "pause blacklist" feature added (admin notice for utility plugins that should be deactivated when not in use)
- it uses the same technique of the previous sections, checking all plugins on activation/deactivation processes, and also every hour via WP cron. The future and pause plugins info is saved in autoloaded options to avoid extra database queries.
- for clarity I have changed the admin notice color codes, now it shows red border left (error code) for deactivated plugins (yellow before), yellow left border (warning) for future plugins (blue before), and blue (info) for pause plugins.
- added a new section
Pause Blacklistin the plugin blacklist.txt template ini file.
- minor performance improvements during the "by code" plugin detection, avoiding the WP active_plugins options update when no banned plugins detected by functions or classes
- initial release
- tested with PHP 7.0
- tested with PHP 7.1
- tested with PHP 7.2
- plugin uses PHP namespaces
- object-oriented codebase
- WP Cron fires 1x hour (de-activates blacklisted plugins)