My code in function.php

if ((date('H') > 17) && (date('H') < 05)) {
    $text-12 = "text-12";
    unregister_sidebar( $text-12 );
}

WordPress structure code;

<div id="widget-area-2" class="site-sidebar widget-area" role="complementary">
<aside id="text-12" class="widget widget_text">
<div class="textwidget">
OFFICE IS CLOSED NOW
</div>
</aside>
</div>

Read more here: WordPress – unregister widget between 17:00 hrs to 05:00 hrs using FUNCTION.PHP file


Solution:

If you know the solution of this issue, please leave us a reply in Comment section, to update the question.


Wordpress related questions and answers: