When I access the Widget page in admin the first widget box is always opened no matter if I closed it in previous session or not.

How to make it closed and not open?

E.g. in this image you can see that the sidebar box is opened and I can see the two widgets with Text and PHP Code there. But how to make it closed (like the Header, Footer and Alert) as default and open only when clicked on the arrow?


This is hardcoded and cannot be changed, the first sidebar box is the only one that doesn't receives a closed CSS class.

You'd have to use jQuery to do it:

add_action( 'admin_footer-widgets.php', function(){
    <script type="text/javascript">
    jQuery(document).ready(function($) {
        $('#widgets-right .widgets-holder-wrap:first').addClass('closed');

There's a small glitch because the box appears opened at first until the jQuery is applied. It can be smoothed with:

add_action( 'admin_head-widgets.php', function(){
    echo '<style type="text/css">#widgets-right {display:none}</style>';

And adding $('#widgets-right').show('slow'); just after the addClass.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.