| 开发者 |
fernandot
ayudawp |
|---|---|
| 更新时间 | 2026年10月3日 03:04 |
| PHP版本: | 7.4 及以上 |
| WordPress版本: | 7.1 |
| 版权: | GPLv2 or later |
| 版权网址: | 版权信息 |
* as a wildcard: shop/* covers /shop/ and everything below itwidget-visibility-control folder to /wp-content/plugins/Yes! Widget Visibility Control works with all widget editing interfaces:
Yes. On activation, the plugin automatically imports all your existing Jetpack Widget Visibility rules. No reconfiguration needed.
Yes, but to avoid conflicts, our visibility interface is automatically disabled while Jetpack Widget Visibility module is active. You can continue using Jetpack's interface, and when you disable the Jetpack module, our interface will take over automatically. Your visibility rules are stored in both formats, so the transition is seamless.
On deactivation, your rules are preserved for when you reactivate. On uninstall, only this plugin's data is removed. If you haven't cleaned the legacy data, Jetpack can still read your original rules.
Yes. You can add multiple conditions and choose whether ALL conditions must match (AND logic) or just ONE condition needs to match (OR logic).
No. The plugin is optimized for performance with intelligent caching. Assets only load on admin widget screens, and frontend checks are minimal and cached.
No. This plugin works completely standalone without any external connections or dependencies.
This plugin is designed for widget areas (sidebars, footers, etc.). Full Site Editing themes typically don't use traditional widget areas - instead, they manage all content through the Site Editor using template parts and blocks. If your FSE theme includes widget areas, the plugin will work in those areas. If you need conditional visibility for blocks in FSE templates, you would need a different solution designed for the Site Editor.
Time scheduling allows you to show or hide widgets during specific date and time ranges. This is ideal for:
When you select "Taxonomy" as a condition, a second dropdown appears where you pick the specific taxonomy (e.g., Product Category, Color, Size). Only then does the third dropdown show the terms for that taxonomy. This cascading approach makes it much faster to find the right term on WooCommerce sites or any site with many custom taxonomies. For hierarchical taxonomies, you can also check "Include children" to automatically match all child terms of the selected term.
Yes, both from Widget Logic 5.x and 6.x — they use the same storage format in the database. When the plugin detects Widget Logic data, you'll see a notice and a section in Appearance > Widget Visibility > Import / Export. The importer shows each widget that had Widget Logic code, the original PHP, and the rule we extracted. For widgets whose code we can't translate automatically, you decide per widget: import as always visible, import as always hidden, or skip.
Most of the common conditional tags: is_home, is_front_page, is_single, is_singular (with or without a post type), is_page (with an ID, a slug, or no arguments at all), is_category, is_tag, is_author, is_archive, is_search, is_404, is_date / is_day / is_month / is_year, is_user_logged_in, is_sticky, is_paged, is_attachment, is_privacy_policy, is_tree, current_user_can, is_tax, has_term, has_category, is_post_type_archive, in_category, and has_tag.
WooCommerce shops are covered too: is_product, is_shop, is_cart, is_checkout, is_account_page, is_product_category, is_product_tag and is_woocommerce.
Rules that are just a constant (true, false, or combinations like !(true || false)) import as always visible or always hidden.
Lists of values are supported too, in both notations: is_page( array( 1, 2, 3 ) ) and is_page( [ 1, 2, 3 ] ). So are negated rules like !is_home(), !is_page(2) && !is_page(3), or !( is_home() || is_category(5) ), which are imported as "hide" rules.
Checks on the current address are translated into URL rules: strpos(), stripos() or str_contains() on $_SERVER['REQUEST_URI'] for "the address contains", strpos( ... ) === 0 or str_starts_with() for "the address starts with", and $_SERVER['REQUEST_URI'] == '/some/path/' for an exact address. Their negated forms are imported as "hide" rules.
Combinations using only AND or only OR are supported. What still cannot be translated automatically: mixed AND/OR expressions, a negated condition combined with a positive one, wp_is_mobile, regular expressions, code reading post meta or any variable other than $_SERVER['REQUEST_URI'], and custom functions. For those the importer tells you why and asks what to do with that widget.
Choose "URL" as the rule type and type the address you want to match. A path is enough (shop, /shop/ and shop/ all mean the same page), and you can also paste the full URL from the browser.
Use * as a wildcard for any run of characters:
shop/* matches /shop/ and everything below itshop* matches /shop/, /shop/shoes/ and also /shopping/*/reviews matches any address whose last part is "reviews"*sale* matches any address with "sale" in it?: shop?orderby=price matches /shop/ with exactly that query, ?*promo=* matches any page that carries a "promo" parameter, and *promo=summer* finds that text anywhere in the address. A ? with nothing after it asks for no query string at all, so /? is the home page only when nothing follows it.
Two things worth knowing. If your site uses a page cache, rules that depend on tracking parameters may not vary, because many caches serve the same stored page whatever the utm_ values are. And a URL rule only looks at the address: to show a widget to certain people, use the User, Role or Capability rules instead.
No. The original Widget Logic data stays in the database so you can roll back if needed. From Appearance > Widget Visibility > Import / Export you can delete it later with "Remove Widget Logic data".
Yes, both. In Appearance > Widget Visibility > Import / Export, the Export section downloads a JSON file with every rule, which widget each one belongs to, the plugin version and the site it came from. The same section restores a file back, so it works as a real backup and as a way to carry a setup from a staging site to production.
When restoring you choose what happens to what is already there: Merge only touches the widgets present in the file and leaves the rest alone, while Replace clears every current rule first so the site ends up exactly as the file describes.
Rules are matched to widgets by their identifier (text-3, categories-2...), so a restore lands correctly on the same site or on a copy of it. On a different site the identifiers may belong to other widgets, so check the result. Anything the file contains that this version does not understand is skipped and reported, never imported half-way.
Not yet. Widget Options stores its visibility data in a format that's very different from Widget Logic and Jetpack, and an importer is a separate effort. If you only used Widget Options for visibility, you can configure the equivalent rules in our plugin manually — the most common scenarios (pages, post types, taxonomies, user roles, login state) are all supported.
* as a wildcard: shop/* covers /shop/ and everything below it, and *sale* any address with that word in it. Query strings can be matched too, as in shop?orderby=price. Available in classic widgets and in block widgets.strpos( $_SERVER['REQUEST_URI'], '/shop/' ) !== false, str_contains(), "starts with" checks and exact comparisons, together with their negated forms. They become URL rules instead of asking you to decide.