WP Shifty Documentation

Current Version: 1.1.2
Text Domain: wp-shifty

Getting Started

Activate WP Shifty

Activation doesn’t require a manual license key. Open the WP Shifty dashboard and click Activate license, select your subscription, then Connect.

Scenarios

What are scenarios?

Scenarios are collections of rules that apply when conditions are met. They can disable plugins, manage CSS/JS (disable, overwrite, lazy/async/defer), preload files, and inject HTML.

How to test rules (Live Preview)

Use Live Preview to test changes safely without affecting the live site. You can emulate devices, user roles, custom headers, cookies, or POST data. Auto-refresh can be disabled to batch changes.

Toolbar shortcuts

When you have permission to manage options, WP Shifty adds an admin toolbar menu with quick actions:

  • Edit matched scenarios for the current request.
  • Add rule to current page/post type/URL directly from the toolbar.

Rules

Manage plugins (Disable plugins)

Toggle plugins off per scenario. When conditions match, the plugin won’t execute at all (not just dequeued). Always verify functionality in Live Preview.

Disable resources

Disable any static resources, including inline CSS or JS. Reduces bloat by removing unneeded files. Be careful disabling JS that other scripts depend on; test interactions afterward.

Overwrite resources

Clone CSS/JS to a safe copy and edit it without touching the original. You can beautify minified sources and re-minify via WP Shifty API, and restore the original with one click.

Load behavior (async, defer, lazy)

  • Lazyload (scripts and styles): load after first interaction (scroll, mousemove, touch, click, keypress).
  • Async (scripts): download asynchronously and execute as soon as loaded.
  • Defer (scripts): download asynchronously and execute after document parsing.

Preload resources

Preload critical assets like LCP images and above-the-fold CSS/JS to improve perceived performance.

Inject HTML

Inject snippets at precise hooks: head beginning/after styles/end and footer beginning/end. Useful for critical CSS, inline scripts, or vendor tags.

Conditions

Page

Match specific page IDs.

Post type

Match the current post type.

Archive

Match archive contexts.

Author

Match author archives.

Match search results pages.

404

Match 404 (not found) requests.

URL

Match by request path (no query) with exact, partial, or regex.

Admin pages

Match specific admin screens including query arguments.

AJAX

Match AJAX actions by exact/partial/regex.

Shop pages

Match WooCommerce core pages.

Frontpage

Match the site front page URL.

Frontend

Apply only on frontend requests.

Everywhere

Apply globally to all contexts.

Query string

Match GET keys/values by exact/partial/regex.

HTTP header

Match HTTP headers (keys normalized to HTTP_*).

Match cookies by key/value with exact/partial/regex.

Post data

Match POST payload (supports regex), preserving plus signs.

User agent

Match UA by exact/partial/regex.

User

Target user roles (including Not logged in).

Device

Match desktop, phone, tablet, Android, iOS, or bots.

Cronjob

Apply for cron runs.

CLI

Apply for WP-CLI runs.

FAQ

Can I test WP Shifty before I buy?

Yes. There’s a 14-day money-back guarantee—buy risk-free and refund within 14 days if it’s not a fit.

Is WP Shifty suitable for beginners?

It’s designed to be easy, but it’s a pro tool. Basic WordPress and performance knowledge is recommended.

How can I know which resources or plugins should be disabled?

Use Live Preview to test safely. Disable candidates and verify the page and interactive features.

Can I buy WP Shifty now?

Yes, purchase is available anytime; activation is a simple connect flow from the dashboard.

How is WP Shifty different from other optimization plugins?

Shifty focuses on conditional loading and selective disabling/rewiring of assets and plugins with a live, scenario-based editor.

Is WP Shifty a cache plugin?

No. It’s not a cache; it controls what loads and when. You can use it alongside caching plugins.

Developers

Actions

  • wp_shifty_match — Fired when at least one scenario should run.
  • wpshifty_collect_resource (type, src, node) — Collected each matching CSS/JS (file or inline).
  • wpshifty_disable_resource (type, src) — A resource was removed.
  • wpshifty_overwrite_resource (type, original, new) — A resource was replaced.
  • wpshifty_lazyload_resource (type, src) — A resource was marked for lazy loading.
  • wpshifty_plugin_disabled (plugin) — A plugin was disabled by a scenario.

Filters

  • wp_shifty_dom (html) — Final HTML just before output buffering ends.

DOM placeholders

WP Shifty uses HTML comment placeholders to inject content or scripts at render time:

  • <!--[if wpshifty]>WP_SHIFTY_HEAD_BEGINNING<![endif]-->
  • <!--[if wpshifty]>WP_SHIFTY_HEAD_AFTER_STYLES<![endif]-->
  • <!--[if wpshifty]>WP_SHIFTY_HEAD_END<![endif]-->
  • <!--[if wpshifty]>WP_SHIFTY_FOOTER_BEGINING<![endif]-->
  • <!--[if wpshifty]>WP_SHIFTY_FOOTER_END<![endif]-->
  • <!--[if wpshifty]>WP_SHIFTY_PRELOAD<![endif]--> — replaced by generated <link rel="preload"> tags.
  • <!--[if wpshifty]>WP_SHIFTY_LAZY<![endif]--> — replaced with the lazy helper script when needed.

Safeguards

Disable switch (?noshifty)

Append ?noshifty=1 to any URL to bypass WP Shifty entirely for that request. No scenarios are evaluated, no plugins are disabled, and no DOM/post-processing happens. This is ideal for troubleshooting or quick A/B checks.

https://example.com/shop?ref=ad
https://example.com/shop?ref=ad&noshifty=1

Note: The parameter is only used by Shifty; it does not affect WordPress routing.

JSON bypass

When the response is JSON (REST API, admin-ajax JSON, or other JSON responses), WP Shifty returns the payload unchanged and skips all HTML DOM manipulation. This ensures API responses are never altered.

  • HTML-only transforms (disable/overwrite/lazy/inject) won’t run on JSON.
  • Use conditions like ajax, query, header, etc., to scope scenarios away from API endpoints when desired.

Per-resource skip

Add data-skip-shifty to any <script>, <style>, or <link> tag to exclude it from all Shifty rules (disable/overwrite/lazy).

<script src="/js/critical.js" data-skip-shifty></script>
<link rel="stylesheet" href="/css/critical.css" data-skip-shifty>

MU Loader and plugin disabling

For plugin deactivation to work reliably, WP Shifty installs an MU loader file wp-content/mu-plugins/__wps-loader.php. If it cannot be created, an exception is raised and disabling plugins will not work. Ensure the MU plugins directory is writable.

Resource matching details

  • Match modes: exact, partial, regex.
  • Versioning: file URLs are normalized to include versions; matching respects ver args.
  • Inline resources: matched by a stable content hash.
  • Preload: disabled resources are skipped; if a source was overwritten, preload uses the overwritten URL.
  • Skip processing: add data-skip-shifty attribute to a tag to exclude it from Shifty rules.

Examples:

// URL exact
/products/sale

// URL partial (matches /products/sale and /products/sale/summer)
/products/sale

// URL regex (matches any year under /archive/)
^/archive/20[0-9]{2}/$

// Inline resource matching
// Inline CSS/JS are matched by a content hash computed at runtime.

Evaluation & Priority

  • Scenario order: active scenarios are loaded by priority DESC, id ASC.
  • Preview: when editing, the preview scenario is applied in isolation and won’t be loaded with other actives; an empty preview shows a placeholder and a special CLI view is available via ?wpshifty-cli=1.
  • Execution flow: when any scenario matches, output buffering is started early and HTML is post-processed to apply rules; scripts/styles are dequeued via wp_print_* / admin_print_* hooks.
  • Toolbar context: matched scenario IDs are exposed for quick edit links.

Changelog

1.1.2 – 2025-04-08

  • [FIX] Minor Bugfixes

1.1.1 – 2025-03-18

  • [NEW] 404 Request condition
  • [NEW] Edit matching rules from topbar
  • [FIX] Minor Bugfixes

1.1 – 2024-11-06

  • [IMPROVE] Must-Have Plugins license management added
  • [FIX] Minor Bugfixes

1.0.14 – 2024-09-30

  • [NEW] Rule order can be changed
  • [NEW] Rules can be named
  • [IMPROVE] Minor improvements

1.0.13 – 2024-04-29

  • [FIX] Rule editor bug with Admin pages

1.0.12 – 2024-03-25

  • [FIX] PHP Compatibility fix

1.0.11 – 2024-02-29

  • [FIX] PHP Compatibility fix

1.0.10 – 2024-02-12

  • [FIX] PHP Compatibility fix

1.0.9 – 2023-12-11

  • [FIX] Minor bugfixes
  • [IMPROVE] Regular Expression Support for Post Data Condition

1.0.8 – 2023-10-25

  • [FIX] CPT category detection issues

1.0.7 – 2023-08-24

  • [FIX] Minor code improvements

1.0.6 – 2023-01-30

  • [FIX] Rank Math compatibility issue

1.0.5 – 2023-01-28

  • [FIX] Post type mismatch
  • [IMPROVE] Hide preview data for non-admin users

1.0.4 – 2023-01-27

  • [FIX] Minor bugfixes
  • [FIX] Custom Post Type issues

1.0.3 – 2022-07-30

  • [FIX] Minor bugfixes
  • [FIX] Not logged in user role issue in editor

1.0.2 – 2022-05-31

  • [FIX] Minor bugfixes
  • [IMPROVE] RTL compatibility

1.0.1 – 2022-04-19

  • [FIX] Minor bugfixes
  • [FIX] Firefox lazyload script issue

1.0 – 2022-03-21

  • [FIX] Minor bugfixes
  • [NEW] Duplicate scenario

0.1.14 – 2022-02-18

  • [FIX] Elementor editor issue

0.1.13 – 2022-02-18

  • [IMPROVE] Compatibility improvements
  • [IMPROVE] Better error messages if network error occured in editor
  • [FIX] Remove the unecessary lazyload option for inline styles
  • [FIX] Minor fixes

0.1.12 – 2022-02-04

  • [IMPROVE] Compatibility improvements
  • [NEW] Add comment to source

0.1.11 – 2022-01-18

  • [FIX] Minor fixes
  • [IMPROVE] Add more devices/screen sizes

0.1.10 – 2022-01-14

  • [IMPROVE] Minor improvements
  • [NEW] Check preview in new tab

0.1.9 – 2022-01-08

  • [FIX] Minor bugfixes
  • [NEW] Cronjob condition
  • [NEW] CLI condition
  • [NEW] Apply wp_shifty_match action when conditions are met

0.1.8 – 2021-12-11

  • [FIX] Fix relative URLs for overwrite CSS
  • [FIX] Fix missing size badge

0.1.7 – 2021-12-06

  • [NEW] Add Lighthouse testing
  • [NEW] Add ?noshifty mode

0.1.5 – 2021-12-05

  • [FIX] PHP warnings & errors

0.1.4 – 2021-12-04

Initial Release

This website uses cookies to enhance your browsing experience and ensure the site functions properly. By continuing to use this site, you acknowledge and accept our use of cookies.

Accept All Accept Required Only