Controlling content visibility in WordPress is a critical capability for designers, developers, and content managers. Whether you want to personalize user experiences, restrict visibility based on device type, or manage time-sensitive campaigns, the ability to conditionally show or hide block content in WordPress unlocks a new level of flexibility.
This guide will walk you through everything you need to know about hiding or showing block content in WordPress using plugins, custom code, and native features in the block editor. Let’s explore how to make your WordPress content more dynamic, efficient, and tailored to every visitor.
Why Control Block Content Visibility in WordPress?
Not every piece of content needs to be visible to every user. Here are a few real-world reasons to control block visibility:
- Display exclusive content only to logged-in users
- Show location-based offers using geotargeting
- Change headlines based on time of day
- Create mobile-specific layouts without duplicating pages
- Run limited-time promotions without manually publishing or unpublishing content
These visibility conditions improve both user experience and content performance, especially on large or complex WordPress sites.
Need Help Customizing WordPress Block Behavior?
Whether you’re building complex editorial workflows or user-specific content structures, our expert developers can help you implement full visibility control using WordPress.
Using Plugins to Show or Hide Block Content in WordPress

Plugins are the most accessible way to implement advanced content visibility controls in the WordPress block editor. Here are the most reliable plugins for this use case.
Block Visibility Plugin
The Block Visibility plugin is a comprehensive tool that adds dozens of visibility settings directly to individual blocks. It integrates with the block editor and supports:
- Device type control (mobile, tablet, desktop)
- Browser targeting (Chrome, Safari, Firefox)
- Date and time scheduling
- Cookie-based personalization
- User roles and login status
- Screen width and screen size
- Referral sources and query strings
- Custom metadata and location detection
These controls are available in the right sidebar under the Visibility section of each block. You can also enable Full Control Mode in the general settings to access every option across all blocks.
Key Features:
- Visibility presets for managing multiple blocks
- URL path conditions for page-specific content
- Hide block from everyone toggle for quick overrides
- Import and export of visibility configurations
This plugin is ideal for web developers managing complex WordPress sites with dynamic content requirements.
Content Control Plugin
The Content Control plugin simplifies block visibility by focusing on two main rule sets:
- Device rules (mobile, tablet, desktop)
- User rules (logged-in, logged-out, specific user roles)
It works well for scenarios where you want different content to display based on login status or screen size. For example, you can serve one image to mobile users and another to desktop users using the same block structure.
Key Features:
- Rule toggles to temporarily disable visibility settings
- Global breakpoint settings in plugin options
- Simple UI integrated into the block editor
- Optional premium features like WooCommerce conditions
This plugin is perfect for beginners or agencies looking for quick device-based or user-based personalization.
Conditional Blocks
Conditional Blocks provides a modal-based interface for adding conditional logic to WordPress blocks. While the free version includes basic features like device and user visibility, the pro version introduces geolocation, scheduling, and membership-based restrictions.
Free Version Offers:
- Lock block from everyone
- Device-based display
- User login conditions
- AND/OR logic combinations
Pro Version Adds:
- Advanced date scheduling
- User role targeting
- WooCommerce and membership controls
- Custom breakpoints and geotargeting
- Preset manager for batch changes
Conditional Blocks is a good middle ground between simplicity and power, especially for teams needing reusable conditions.
Wicked Blocks Condition
Wicked Blocks Condition is a lesser-known plugin with developer-friendly options like custom PHP functions. It allows blocks to show or hide based on:
- User role or login status
- Date and time ranges
- Post status or categories
- URL query strings
- Custom logic functions
If you want to combine low-code flexibility with editor-based control, this plugin is a solid choice.
Plugin Comparison Table
Plugin Name | Key Features | Ideal Use Case |
---|---|---|
Block Visibility | Date/time, geolocation, user role, screen size, cookies | Complete visibility control |
Content Control | Device and user role rules | Lightweight use cases |
Conditional Blocks | AND/OR logic, presets, advanced breakpoints | Mid-size to advanced implementations |
Wicked Blocks Condition | PHP function support, query string targeting | Developer-oriented control |
Custom Code Snippets to Hide or Show Content in WordPress
If you prefer to avoid plugins, you can use native WordPress functions and conditional logic to control visibility. These examples can be added to a custom plugin or your child theme’s functions.php file.
Hide Content for Logged-in Users
add_action( 'wp_head', 'custom_hide_paragraphs_for_logged_in' );
function custom_hide_paragraphs_for_logged_in() {
if ( is_user_logged_in() ) {
echo 'p { display: none !important; }';
}
}
This hides all paragraph elements for users who are logged in. You can reverse the condition or target other elements based on your needs.
Hide Content Based on Geolocation
add_action('wp_head', 'custom_hide_images_us');
function custom_hide_images_us() {
$ip = $_SERVER['REMOTE_ADDR'];
$geo = "https://ipapi.co/{$ip}/json/";
$response = wp_remote_get($geo);
if ( is_wp_error($response) ) return;
$data = json_decode( wp_remote_retrieve_body($response) );
if ( isset($data->country_code) && $data->country_code === 'US' ) {
echo 'img { display: none !important; }';
}
}
Use this script to hide all images for users visiting from the United States. Be aware that API calls on every page load can affect performance, so use transients or caching where possible.
Hide Featured Image by Category
add_filter('post_thumbnail_html', 'custom_hide_featured_image', 10, 2);
function custom_hide_featured_image($html, $post_id) {
if ( has_category('books', $post_id) ) {
return '';
}
return $html;
}
This code removes the featured image on all posts assigned to the category “books.” You can modify it for tags, custom taxonomies, or metadata.
Testing Content Visibility Conditions
To avoid surprises on your live site, here are some testing best practices:
- Use staging environments for trial runs
- Clear browser and site cache before viewing changes
- Switch user roles to verify visibility conditions
- Check page source to confirm if hidden elements are being removed or just hidden with CSS
- Use browser dev tools to simulate different devices and screen sizes
These precautions help you avoid SEO issues and unexpected behavior, especially on large WordPress websites.
Plugin Settings and Tips
Each plugin mentioned above comes with specific configuration areas inside WP Admin > Settings. Depending on your plugin, you can:
- Define device breakpoints
- Enable block visibility in the editor panel
- Disable plugins on certain blocks
- Activate full control or debug modes
Understanding the default visibility controls and customizing them to match your editorial workflow will result in better content governance across your site.
When Should You Use a Plugin vs. Custom Code?
Choosing between plugins and custom code depends on your project’s complexity, team skills, and performance goals.
Use a Plugin If:
- You need non-technical users to manage visibility
- Your site requires dozens of conditions across pages
- You want access to pro features like scheduling or geotargeting
Use Custom Code If:
- You want leaner performance
- You’re targeting unique conditions not supported by plugins
- Your site is small and tightly scoped
For large sites, a hybrid approach often works best. Use plugins for regular visibility controls and write custom logic where needed.
Practical Use Cases for WordPress Block Visibility
Understanding visibility controls is one thing. Applying them effectively is another. Let’s explore specific real-world situations where conditionally displaying content blocks becomes an essential part of website strategy.
Personalized Content for Logged In Users
Many membership sites, eLearning platforms, and internal business dashboards use visibility conditions to restrict content. You can display a welcome message or personalized dashboard only for logged in users. If someone logs out, the same content block automatically disappears from view.
This is easily handled with the block visibility plugin or Content Control by assigning visibility settings based on user role and login status. It’s a user-friendly method of content segmentation without needing advanced development skills.
Multilingual WordPress Sites
Global businesses often create different content blocks for each language. Instead of building multiple pages, you can use block visibility controls to conditionally display blocks based on user preferences or location. Combine geolocation logic with multilingual plugins to serve region-specific content without duplicating effort.
Announcements Based on Time
You may want to run flash sales, product launches, or promotional banners that display only during a certain time window. Using the date and time conditions in the block visibility plugin, you can schedule blocks to show or hide at precise moments.
This kind of automation keeps your WordPress website current and eliminates the need to manually publish or remove blocks.
Conditional Layouts for Mobile Devices
Different screen sizes often require different layouts. Instead of creating multiple versions of a page, block visibility settings let you create mobile-specific content blocks. Display blocks based on screen size or device type and improve mobile UX while keeping everything editable in one place.
This is especially helpful for showcasing different navigation, buttons, or image sizes for smaller screens, enhancing usability and page performance.
How Visibility Controls Work in the WordPress Block Editor
If you’re using the Gutenberg block editor (now the standard for WordPress), visibility settings appear in the right-hand sidebar once a plugin like Block Visibility or Conditional Blocks is installed.
When editing a post or page:
- Select a content block
- Look for a section labeled Visibility or Display Conditions
- Use the checkboxes, dropdowns, or toggle switches to control who sees the block and when
Some plugins also add a toolbar icon or settings under “Advanced” in the block editor section. These allow quick access to visibility options like screen size, user roles, login status, or URL query strings.
Best Practices for Managing Visibility Settings
To avoid confusion and manage performance, here are a few expert tips:
- Group related blocks: Use block groups or patterns to apply visibility rules across sections
- Use presets: In tools like Block Visibility or Conditional Blocks, save common settings as presets
- Limit plugin overlap: Avoid using multiple plugins for the same purpose to reduce conflicts
- Train your team: Non-technical editors should understand visibility conditions to avoid misconfiguration
- Test all user roles: Verify how each content block appears for different user types, logged in or logged out
These habits help maintain clean workflows and avoid performance issues or content confusion.
Final Thoughts
The ability to hide or show block content in WordPress is no longer a developer-only feature. With the right plugins or custom code, anyone can create tailored user experiences that respond to role, location, device, or time.
Whether you’re building a membership portal, eCommerce site, or enterprise-grade content hub, content visibility settings help you deliver the right message to the right audience at the right time.
By mastering block visibility controls, you unlock a more dynamic, personalized, and performance-oriented WordPress site.