=== Wondalizer Asset Unloader === Contributors: wondalizer Tags: performance, plugins manager, unload plugins, dequeue assets, optimization Requires at least: 5.8 Tested up to: 6.8 Requires PHP: 7.2 Stable tag: 2.1.0 License: GPLv2 or later License URI: https://www.gnu.org/licenses/gpl-2.0.html A standalone multi-rule Plugins Manager for unloading plugin PHP, CSS and JavaScript only where they are not needed. == Description == Wondalizer Asset Unloader provides the essential plugins-manager workflow without requiring WP Asset CleanUp. Active plugins appear first, inactive plugins follow, and every plugin has an expandable options panel. Features: * Early PHP unloading plus independent CSS and JS controls. * Multiple rules per plugin with Add rule, Duplicate, Disable and Remove controls. * Per-rule PHP, CSS and JS targets — each rule unloads only the checked combination. * Always unload and Always load actions. A matching Always load rule overrides unload rules only for the targets it covers. * Front-end, dashboard, admin-AJAX, REST API or all-request contexts. * Homepage, blog index, posts, pages, products, shop, singular content, custom post types and post-type archives. * Content-is and Content-is-not conditions. * Any user, logged-in or logged-out conditions. * Optional logged-in role lists using any-role/OR matching. * Multiple URI conditions per rule using OR logic. * Contains, not-contains, exact, not-exact, starts, ends, wildcard and negative wildcard matching. * Regex, ignore-case regex, full-path, anchored-start, anchored-end and negative regex variants. * Cached content URL map with automatic scheduled refreshes and a manual rebuild button. * Active-first sorting, search and active/inactive/configured filters. * Private recovery URL, wp-config.php emergency constant and developer hooks. == Installation == 1. Upload and activate the plugin. 2. Activation installs wp-content/mu-plugins/wondalizer-asset-unloader.php, required for early PHP unloading. 3. Open Plugins > Asset Unloader. 4. Choose PHP, CSS and/or JS beside a plugin, open More options and add one or more rules. 5. Save, test the targeted requests and purge your existing page/cache layer if necessary. If mu-plugins is not writable, CSS/JS rules can still operate, but PHP unloading cannot. Fix permissions and reactivate. == Rule logic == Conditions within one rule are ANDed: * Request context * Content condition * Login condition * Selected roles * The URI condition group URI lines within a rule are ORed: any one matching line satisfies the URI group. Use separate rules for alternative condition groups. Blank URI lines match every path. Leaving every role unchecked allows any role. A matching Always load rule wins over all Always unload rules for the targets it covers — a CSS-only Always load does not cancel a PHP unload. Disabled rules are ignored. Rules with no target checked are ignored. PHP unloading is like deactivating the plugin for that request; CSS/JS-only unloading preserves its PHP. Page-cache warning: logged-in and role-based rules require a cache that varies by user or login state, or bypasses cached pages for those visitors. Otherwise, cached HTML and assets can reflect another visitor's rules. Version 1 flat rules are converted automatically to the version 2 multi-rule format. == Content rules == General content rules use a cached map built while WordPress is fully loaded. This allows the early loader to recognize: * Homepage and blog index * All single posts and pages * All single products and the shop page * All singular content * Public custom post type singles * Public post type and product archives The map refreshes after content, plugin, theme and permalink changes. Use Rebuild content map now after importing content or changing URLs in unusual ways. Plain-permalink p and page_id URLs are mapped by ID. URI rules themselves still ignore query strings. == URI and regex examples == * Contains: /shop/ * Exact path: /contact/ * Starts with: /members/ * Wildcard: /products/* * Regex: #^/(shop|checkout)/?$# * Only /members with optional trailing slash: #^/members/?$# * /members and its subpaths: #^/members(?:/|$)# * members as a path segment, ignore case: #(?:^|/)members(?:/|$)#i */members/* is not a valid regular expression and does not mean only /members. Use Exact path or #^/members/?$# instead. Regex patterns use a delimiter such as # at both ends. Regex full path adds ^ and $ around the supplied expression; anchored-start and anchored-end add only their respective anchor. == Emergency recovery == The management page displays a private recovery URL containing wondalizer_recovery. Opening it bypasses all rules for that request. To disable all filtering globally, add this to wp-config.php: define( 'WONDALIZER_ASSET_UNLOADER_DISABLE', true ); The plugin never unloads itself and protects WP-CLI, cron, installation, XML-RPC, login, plugin-management and update requests. == Programmatic usage == The legacy flat API remains supported: wondalizer_unload_plugin( 'example-plugin/example-plugin.php' ); A complete multi-rule configuration can be supplied with php/css/js flags and a rules array. Each rule supports enabled, action, targets, context, content, content_mode, user, roles and uri. Targets is an array of php/css/js flags defaulting to the plugin-level flags when omitted. URI entries contain match and pattern. Available filters: * wondalizer_asset_unloader_rules * wondalizer_asset_unloader_request * wondalizer_asset_unloader_user * wondalizer_asset_unloader_content_types * wondalizer_asset_unloader_php_unloads * wondalizer_asset_unloader_active_plugins Available actions: * wondalizer_asset_unloader_plugins_filtered * wondalizer_asset_unloader_assets_dequeued == Performance notes == The early runtime reads the autoloaded rules option once and caches request, user and content resolution. The content map is loaded only when a content-specific rule needs it. Visitor requests do not enumerate installed plugins, query posts or write content-map data. Map generation runs in admin or a scheduled background event. == Changelog == = 2.1.0 = * Added per-rule PHP, CSS and JS targets so each rule unloads only the checked combination. * Always load rules now override unload rules per target instead of for the whole plugin. * Rules saved before 2.1 keep their behavior: targets inherit the plugin-level flags. = 2.0.0 = * Added multiple rules and URI conditions per plugin. * Added Always load priority, content targets, user/login and role conditions. * Added cached content mapping and expanded regex modes. * Rebuilt the interface with active-first sorting and expandable option panels. * Preserved automatic version 1 rule migration. = 1.0.0 = * Initial standalone Plugins Manager release.