Hide This Shortcode

Below, you’ll find a detailed guide on how to add the Hide This Shortcode to your WordPress website, including its parameters, examples, and PHP function code. Additionally, we’ll assist you with common issues that might cause the Hide This Plugin shortcode not to show or not to work correctly.

Before starting, here is an overview of the Hide This Plugin and the shortcodes it provides:

Plugin Icon
Hide This

"Hide This is a WordPress plugin that provides a simple yet effective solution for selectively hiding content on your website. It offers a convenient and secure way to manage visibility."

★★★★★ (49) Active Installs: 4000+ Tested with: 4.9.24 PHP Version: false
Included Shortcodes:
  • [hide]

Hide This [hide] Shortcode

The Hide_This shortcode is a handy tool in WordPress. It enables users to selectively hide certain content on their site. This shortcode works by creating a new instance of the Hide_This class, passing in the attributes and content. The ‘__get’ method then retrieves the ‘content’ property, effectively hiding the specified content.

Shortcode: [hide]

Examples and Usage

Basic example – A simple use case of the hide-this shortcode where we hide a specific section of the content.

[hide id="section1"]Hidden Content[/hide]

Advanced examples

Here, we’re using the shortcode to hide a section of the content based on user role. Only users with the role of ‘administrator’ can see the content.

[hide role="administrator"]Hidden Content for Non-admins[/hide]

In this example, we’re using the shortcode to hide content based on a specific date. The content will only be visible after the specified date.

[hide date="2022-12-31"]Hidden Content until New Year's Eve[/hide]

Here, the shortcode is used to hide content based on a specific time. The content will only be visible after 6 PM.

[hide time="18:00"]Hidden Content until evening[/hide]

This example shows the shortcode used to hide content based on user’s IP address. Only users with the specified IP address can see the content.

[hide ip=""]Hidden Content for specific IP[/hide]

PHP Function Code

In case you have difficulties debugging what causing issues with [hide] shortcode, check below the related PHP functions code.

Shortcode line:

add_shortcode( 'hide', array( $this, 'shortcode' ) );

Shortcode PHP function:

function shortcode( $atts, $content ) {
		$hide_this = new Hide_This( $atts, $content );
		return $hide_this->__get( 'content' );

Code file location:



Now that you’ve learned how to embed the Hide This Plugin shortcode, understood the parameters, and seen code examples, it’s easy to use and debug any issue that might cause it to ‘not work’. If you still have difficulties with it, don’t hesitate to leave a comment below.


Leave a Reply

Your email address will not be published. Required fields are marked *