Este plugin no se ha probado con las últimas 3 versiones mayores de WordPress. Puede que ya no tenga soporte ni lo mantenga nadie, o puede que tenga problemas de compatibilidad cuando se usa con las versiones más recientes de WordPress.

Mostrar/Ocultar contenido a la hora establecida


Like this plugin? Consider leaving a quick review or writing about how you’ve used it on your site – send me a link to that write up if you do.

This plugin is maintained on GitHub, so feel free to use the repository for reporting issues, submitting feature requests and submitting pull requests.

This plugin provides shortcodes allowing you to display content or hide content at given dates and times. You can also combine the two to show some content at a given time, and then hide it at another time.

There’s also a separate shortcode if you want to repeat a schedule for showing and hiding content – for example to only show information about a radio show while it’s on air.

Uso – uso único

To show or hide content at one point in time, you can use the [time-restrict] shortcode. For example:

[time-restrict off="2015-01-01"]Please enter our competition[/time-restrict]
[time-restrict on="2015-01-01"]Sorry, this competition has closed[/time-restrict]

If you do not enter a time with the date, it will default to 00:00:00, so in the above example, the first message will show up until 2015-01-01 00:00:00 (i.e. until the first second of 2015) and the second message will show up from 2015-01-01 00:00:00 (i.e. from the first second of 2015)

Puedes usar cualquier cadena de fecha u hora soportada por PHP , como:

[time-restrict off="September 10th, 2014"]Will display until 09/10/2014[/time-restrict]
[time-restrict off="2014-09-10"]Will display until 09/10/2014[/time-restrict]
[time-restrict off="10-Septmber 2014"]Will display until 09/10/2014[/time-restrict]
[time-restrict on="2014/09/10 18:00:00"]Will show after 09/10/2014 at 6pm[/time-restrict]

También puedes combinar las fechas de inicio y finalización para el mismo contenido. Entonces, si quieres que aparezca algo de contenido entre el 1 de enero y el 10 de enero, puedes hacer lo siguiente:

[time-restrict on="2015-01-01" off="2015-01-11"]
This is a limited time offer

Uso – calendario de repetición

To show and hide content on a recurring schedule, you can use the [time-restrict-repeat] shortcode. Your options are a daily, weekly, monthly or annual schedule.

A daily schedule takes the following form:

[time-restrict-repeat type="daily" ontime="09:00:00" offtime="17:00:00"]
Working 9 to 5

Note that you can also cross over midnight, so to only show something from 10PM to 5AM, you can use:

[time-restrict-repeat type="daily" ontime="22:00:00" offtime="05:00:00"]
For the night owls

A weekly schedule takes the following form:

[time-restrict-repeat type="weekly" onday="Monday" offday="Friday"]
The work week

También puedes especificar las horas de inicio y finalización si así lo deseas (se supondrá que comenzará a las 00:00:00 y terminará a las 23:59:59 si se omiten, como se indicó anteriormente):

[time-restrict-repeat type="weekly" onday="Friday" offday="Monday" ontime="17:00:00" offtime="08:00:00"]
It's the weekend baby!

A monthly schedule takes the following form:

[time-restrict-repeat type="monthly" ondate="01" offdate="07"]
The first week of the month

You can both cross over the end of the month, and apply times to your start and end dates, e.g.

[time-restrict-repeat type="monthly" ondate="25" offdate="05" ontime="17:00:00" offtime="08:00:00"]
We are exceptionally busy at the end of each billing cycle. Please bear with us!

And lastly, an annual schedule takes the following form:

[time-restrict-repeat type="annually" onmonth="June" offmonth="August" ondate="01" offdate="31"]
I'm currently in the mountains enjoying the summer!

You can cross over the end of the month or even the end of the year, and apply times to your start and end dates, e.g.

[time-restrict-repeat type="annually" onmonth="December" ondate="24" offmonth="January" offdate="05" ontime="17:00:00" offtime="08:00:00"]
Our employees are currently enjoying time with their families for Christmas. We'll be back after the New Year.

If you’re feeling creative, you can even nest shortcodes to account for multiple concurrent conditions. Since you cannot nest shortcodes with the same name, you need to add -2 or -3 to time-restrict-repeat in your shortcode (e.g. [time-restrict-repeat-2]).

Por ejemplo, mostrar un mensaje durante el horario comercial solo de lunes a viernes:

[time-restrict-repeat type="daily" ontime="08:00:00" offtime="17:00:00"]
[time-restrict-repeat-2 type="weekly" onday="Monday" offday="Friday"]
Our store is currently open

You can also define a message which should appear if your content is not showing by using the else attribute @since 2.5. For example, you could invite people to visit your store during opening hours and ask them come back soon otherwise, like this:

[time-restrict-repeat type="daily" ontime="08:00:00" offtime="17:00:00" else="We're currently closed. Come back and see us when we're open."]
[time-restrict-repeat-2 type="weekly" onday="Monday" offday="Friday" else="We're currently closed. Come back and see us when we're open."]
Our store is currently open

Ten en cuenta que con los códigos cortos anidados, debes añadir el atributo elsea cada shortcode.

Cosas a tener en cuenta

I also run Do It With WordPress, which has an array of tutorials for managing, modifying and maintaining your WordPress sites, as well as The WP Butler, a service for keeping your site maintained, backed up, updated and secure.


  1. Upload to the /wp-content/plugins/ directory
  2. Activa el plugin desde el menú ‘Plugins’ de WordPress
  3. Usa shortcodes alrededor de tu texto


How do I get the plugin to do «this»?

Check the Description tab for several examples showing what the plugin can do.

If you’re still stuck, the best thing to do is to submit an issue on GitHub. If you don’t have a GitHub account, then get in touch with me and I’d be glad to help you out.

Can you add a feature to this widget?

Probably. The best thing to do is to create a new feature request on GitHub. If you don’t have a GitHub account, then tell me what this widget should do that it doesn’t currently.

Something’s not right. What should I do?

The best thing to do is to submit an issue on GitHub. If you don’t have a GitHub account, then get in touch with me and I’ll see about getting it fixed.


18 de junio de 2021
Perfect! We have a form for the new guests that allows us to make a donation to a charity of their choice. We can’t have people using this form all week long. This is great, turns on when we offer, turns off after the event. Yes!! We put the WPforms shortcode between the Time restrict.
21 de enero de 2021 1 respuesta
Thank you for this powerful and easy to use plugin. It does exactly what I need. I am using it for educational purposes. Specifically, we want to make some information available at exactly 30 minutes before an exam starts. With your plugin, we are able to set everything up in advance and not worry about it. I hope that you continue to develop and support it! Thanks so much.
2 de junio de 2020
Even worked with my other wp shortcodes so I could display forms during business hours.
22 de abril de 2020 1 respuesta
I had to publish a contact form on my site, but only after a certain date, and leave it open during a limited period. Your plugin did the job perfectly ! Many thanks for your efforts in developing it, much appreciated !
4 de noviembre de 2018
This helped me to create a radio statioon website. Thanks for your plugin. Best regards
Leer todas las 33 reseñas

Colaboradores y desarrolladores

«Mostrar/Ocultar contenido a la hora establecida» es un software de código abierto. Las siguientes personas han colaborado con este plugin.


Registro de cambios


Fecha de lanzamiento: 14 de diciembre de 2016

  • Addition of else parameter.
  • Retire old (pre v2.0) shortcodes.


Release date: May 23, 2016

  • Coding standards, logic and performance improvements.


Release date: August 31, 2015

  • Corrected an error in the weekly logic (props Jérôme)


Release date: December 5, 2014

  • Introduced recurring annual schedule (previously only monthly/weekly/daily). Just use type=»annually» in your shortcodes.
  • Mejoras de código.


Release date: October 9, 2014

  • Fixed inability to nest shortcodes by introducing distinct copies of the time-restrict-repeat shortcode ([time-restrict-repeat-2] and [time-restrict-repeat-3])


Release date: October 2, 2014

  • Se corrigió el error por el cual el contenido se mostraba todo el tiempo cuando coincide con el día y día festivo, o con la coincidencia entre fecha y hora.


Release date: August 30, 2014

  • Código revisado para permitir que el día y día festivo sean lo mismo. Lo mismo para ondate y offdate.
  • Changed attributes for [time-restrict] shortcode to be more in line with the rest of the plugin. Now using ‘on’ and ‘off’ instead of ‘show’ and ‘hide’, though the show and hide attributes will continue to work.


Release date: August 22, 2014

  • New combined [time-restrict] shortcode allows for hide and show times for the same piece of content
  • New [time-restrict-repeat] shortcode allows you to show and hide content on a daily, weekly or monthly recurring basis
  • Mejoras de código
  • Legacy shortcode support
  • Enables nesting shortcodes within new shortcodes
  • Plugin now respects site’s local time, rather than server time