Contributors: cybokron Tags: widget, visibility, descendants, grandchildren, pages Requires at least: 5.2 Tested up to: 6.9 Stable tag: 1.7.0 Requires PHP: 7.4 License: GPLv2 or later License URI: https://www.gnu.org/licenses/gpl-2.0.html
Show or hide widgets by page, category, taxonomy, post type, and user context with descendant support.
== Description ==
Jetpack's Widget Visibility only supports "Include children" which covers direct children (1 level deep). It doesn't include grandchildren, great-grandchildren, or deeper nested pages.
Example:
/services/ ← Parent
/services/web-design/ ← Child (Jetpack ✓)
/services/web-design/pricing/ ← Grandchild (Jetpack ✗)
/services/web-design/pricing/faq/ ← Great-grandchild (Jetpack ✗)
This plugin adds an "Include all descendants" option that includes ALL levels of nested pages - grandchildren, great-grandchildren, and beyond.
- 🎛️ Show/Hide widgets based on conditions
- 📄 Page visibility with full descendant support
- 📁 Category visibility with hierarchy support
- 🏷️ Hierarchical custom taxonomy visibility with descendant support
- 📝 Post type conditions
- 🏠 Special pages: Front page, Blog, Archive, Search, 404
- 👥 User role targeting (any selected role)
- 👤 User state: Logged in / Logged out
- 🔗 Multiple conditions with AND/OR logic
- 🚀 Jetpack-free - no dependencies
- 🌍 30 languages included
- 🔒 Secure - follows WordPress coding standards
- Download the latest release from Releases
- Upload to
/wp-content/plugins/ - Activate the plugin in WordPress Admin → Plugins
cd /path/to/wordpress/wp-content/plugins/
git clone https://github.com/ercanatay/cybokron-advanced-widget-visibility.git- Download the ZIP file
- Go to WordPress Admin → Plugins → Add New → Upload Plugin
- Upload the ZIP file and activate
- Go to Appearance → Widgets
- Edit any widget
- Click the "Visibility" button
- Choose Show or Hide
- Select condition type (Page, Category, etc.)
- Select the specific item
- Check "Include all descendants" for nested pages
- Click Done and save the widget
| Option | Covers | Example |
|---|---|---|
| Include children | Direct children only (1 level) | /parent/child/ ✓ |
| Include all descendants | All nested levels (unlimited) | /parent/child/grandchild/great/ ✓ |
- Add multiple rules with the + button
- Check "Match all conditions" for AND logic (all rules must match)
- Leave unchecked for OR logic (any rule can match)
| Type | Description |
|---|---|
| Page | Specific page with optional descendants |
| Category | Category archive or posts in category |
| Taxonomy | Hierarchical public custom taxonomy archive/posts with optional descendants |
| Post Type | Any post type (post, page, custom) |
| User Role | Match logged-in users by one or more selected roles |
| Front Page | Site front page |
| Blog | Blog posts page |
| Archive | Any archive page |
| Search | Search results page |
| 404 | Not found page |
| Single Post | Any single post |
| Logged In | User is logged in |
| Logged Out | User is not logged in |
The visibility panel appears below each widget with:
- Show/Hide dropdown
- Condition type selector
- Value selector (pages, categories, etc.)
- "Include children" checkbox
- "Include all descendants" checkbox (the key feature!)
- "Match all conditions" for AND/OR logic
- WordPress 5.2 or higher
- PHP 7.4 or higher
🇹🇷 Turkish, 🇺🇸 English, 🇪🇸 Spanish, 🇩🇪 German, 🇫🇷 French, 🇮🇹 Italian, 🇧🇷 Portuguese (Brazil), 🇵🇹 Portuguese (Portugal), 🇳🇱 Dutch, 🇵🇱 Polish, 🇷🇺 Russian, 🇯🇵 Japanese, 🇨🇳 Chinese (Simplified), 🇹🇼 Chinese (Traditional), 🇰🇷 Korean, 🇸🇦 Arabic, 🇮🇱 Hebrew, 🇸🇪 Swedish, 🇳🇴 Norwegian, 🇩🇰 Danish, 🇫🇮 Finnish, 🇬🇷 Greek, 🇨🇿 Czech, 🇭🇺 Hungarian, 🇷🇴 Romanian, 🇺🇦 Ukrainian, 🇻🇳 Vietnamese, 🇹🇭 Thai, 🇮🇩 Indonesian, 🇮🇳 Hindi, 🇸🇰 Slovak
Yes, this is a standalone alternative. You can use this instead of Jetpack's visibility feature, or alongside it (they work independently).
No. The visibility checks are very lightweight and only run when widgets are being displayed.
This plugin works with classic widgets. For block-based widget areas, the visibility controls appear in the widget settings.
- Feature: Added dedicated settings page with dashicons-visibility sidebar icon.
- Feature: Global bypass toggle to temporarily disable all visibility rules for debugging.
- Feature: Configurable maximum rules per widget (1-200, default 50).
- Feature: Option to delete all visibility data when plugin is uninstalled.
- Feature: Colored application icon displayed on settings page header.
- Enhancement: Quick links to Widgets page and GitHub support.
- Changed: Sidebar icon now uses WordPress dashicon instead of base64 PNG.
- Added: Admin menu page with custom sidebar icon for quick access to plugin info.
- Added: Plugin icon in WordPress admin sidebar.
- Enhancement: About page with getting started guide and feature overview.
- Rebranded: Plugin renamed to "Cybokron Advanced Widget Visibility".
- Changed: Plugin URI updated to new GitHub repository.
- Changed: All GitHub links updated to new repository name.
- Changed: Translation template and catalog headers updated.
- Fixed: Text domain aligned to WordPress.org assigned slug
widget-visibility-with-descendants. - Fixed: Renamed main plugin file to match WordPress.org slug.
- Fixed: Removed
.distignorefrom distribution package. - Changed: Translation file names updated to match new text domain.
- WordPress.org submission release.
- Changed: Renamed plugin slug and main file to
cybokron-descendant-visibility-widgets. - Changed: Text domain aligned to plugin slug.
- Changed: Contributors updated to valid WordPress.org username
cybokron. - Added:
readme.txtin WordPress.org standard format. - Added:
.distignorefor clean distribution packaging. - Added:
uninstall.phpwith properWP_UNINSTALL_PLUGINguard. - Added: GitHub Actions deploy workflow for WordPress.org SVN.
- Security: Restricted widget visibility UI rendering to users with
edit_theme_options. - Security: Prevented visibility data loss by restoring previous
wvd_visibilitysettings when unauthorized users trigger widget updates.
- Docs: Reviewed recent merged PRs and synchronized release notes for maintainers.
- Maintenance: Added explicit PR references to latest stabilization and compliance work (PR #25, PR #24).
- Review: Confirmed there are no currently open pull requests pending merge.
- Fix: Added defensive
is_array()validation for widget instance payloads in both admin save and frontend display callbacks. - Stability: Prevents fatal errors when third-party filters or corrupted widget data pass non-array widget instances.
- Performance: Eliminated N+1 admin queries in page/category option generation by using lookup maps for parent-child detection.
- Stability: Prevented duplicate admin panel event handlers by namespacing jQuery bindings and unbinding old handlers before re-render.
- Hardening: Strengthened frontend rule validation with
absint()guards and post type existence checks. - Cleanup: Removed unnecessary rewrite-rule flush hooks and obsolete textdomain-loading stub.
- Accessibility: Converted visibility panel action controls (
Remove,Add condition,Delete) from anchor tags to semanticbuttonelements. - Accessibility: Added
aria-labelto icon-only remove control to improve screen-reader support. - Accessibility: Added keyboard-visible focus styles for action controls.
- Compliance: Removed custom GitHub updater integration to satisfy WordPress.org plugin directory rules.
- Compliance: Removed
Update URIheader and updater hooks that modified plugin update transients. - Maintenance: Removed updater settings/admin page and related updater classes.
- Security: Ensured widget visibility sanitization is always initialized for REST widget updates, preventing
is_admin()context bypasses. - i18n: Synced all
.pocatalogs with the latest.pottemplate and removed obsolete translation keys. - i18n: Added fallback translations for newly introduced updater strings across language files and completed Turkish translations for updater text.
- i18n: Recompiled all
.mobinaries from updated.posources.
- Feature: Added GitHub updater integration using WordPress native plugin update flow.
- Feature: Added settings page at Settings → Widget Visibility Updates.
- Feature: Added update channel control (
stable/beta) with defaultstable. - Enhancement: Added plugin row Update Settings quick link in Plugins screen.
- Enhancement: Added package source normalization during upgrade to ensure correct plugin folder replacement.
- Maintenance: Added updater cache cleanup after settings changes and successful plugin upgrades.
- Fix: Removed hidden tracked development artifact at
.jules/sentinel.mdto avoid hidden-file check warnings. - Fix: Normalized mixed line endings to LF in
README.mdandassets/css/admin.css. - i18n: Renamed translation files in
languages/towidget-visibility-descendants-main-*so file names align with the active text domain.
- Fix: Standardized plugin text domain usage to
widget-visibility-descendants-mainacross plugin headers and admin UI translation calls. - Fix: Normalized
grandchildren-visibility.phpto LF line endings to prevent mixed EOL warnings. - Fix: Removed root
.gitignorefrom distributable plugin files to satisfy hidden-file checks.
- Fix: Improved category rule evaluation robustness for single posts (PR #19).
- Stability: Switched post ID lookup to
get_queried_object_id()in widget visibility checks. - Hardening: Added zero-ID guard and
WP_Error/array validation forwp_get_post_categories()results. - Type Safety: Cast single-post category IDs to integers for reliable strict comparison.
- Feature: Added
taxonomyrule type for hierarchical custom taxonomies (archive + singular post term matching). - Feature: Added descendant and child matching support for custom taxonomy terms.
- Feature: Added
user_rolerule type with multi-select role matching (any selected role). - Security: Added strict sanitization/validation for taxonomy slugs, term IDs, post types, and role arrays.
- Performance: Added request-level taxonomy ancestor caching in frontend evaluator.
- i18n: Added new admin UI strings and updated translation template (.pot) for taxonomy/user role controls.
- Security: Added defensive checks to category visibility evaluation to avoid invalid object property access.
- Stability: Validate
get_queried_object()returns aWP_Termbefore reading term properties on category archives. - Stability: Validate
get_category()results and guard againstWP_Errorbefore reading parent term data on single posts. - Hardening: Prevent potential PHP warnings/errors and reduce information leakage risk in edge-case category queries.
- Fix: Category visibility type safety — cast
get_ancestors()results to int for reliable strict comparison - i18n: Complete internationalization of admin JS by replacing hardcoded English labels with
wvdData.i18n.*references - i18n: Add missing rule type translation keys (Front Page, Blog, Archive, Search, 404, Single Post, Logged In, Logged Out, Select a post type, Configured)
- Security: Remove unimplemented
taxonomyandauthorfrom allowed rule types whitelist - Updated translation template (.pot) with new strings
- Security: Replaced json_encode with wp_json_encode for better WordPress compatibility
- Security: Added capability check (edit_theme_options) before saving widget settings
- Defense-in-depth protection for widget update callback
- Security: Added XSS sanitization for page/category/post type titles
- Security: Added DoS protection with rule type whitelist
- Security: Limited maximum rules to 50 to prevent resource exhaustion
- Security: Limited value length to 100 characters to prevent database bloat
- Added 30 language translations
- Turkish, Spanish, German, French, Italian, Portuguese, Dutch, Polish, Russian, Japanese, Chinese, Korean, Arabic, Hebrew, Swedish, Norwegian, Danish, Finnish, Greek, Czech, Hungarian, Romanian, Ukrainian, Vietnamese, Thai, Indonesian, Hindi, Slovak
- Fixed descendant detection bug (ancestor ID type conversion issue)
- Improved reliability for deeply nested page hierarchies
- Initial release
- Page visibility with full descendant support
- Category visibility with hierarchy support
- Post type, special pages, and user state conditions
- Multiple conditions with AND/OR logic
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the GPL v2 or later - see the LICENSE file for details.
Ercan ATAY
- Website: ercanatay.com
- GitHub: @ercanatay
If you encounter any issues or have questions:
- Open an issue on GitHub Issues
- Check existing issues for solutions
Note: This plugin is a standalone solution and does not require Jetpack. If you have Jetpack installed, both visibility systems will work independently.