Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Is there a code in functions.php that I can add to disable or hide "collapse menu" button?

The one that is on the left side of the admin menu in the dashboard. I'd need it for both admin, authors, contributors.

share|improve this question
1  
What "collapse menu"? Please, be as detailed as possible when asking Questions... –  brasofilo Mar 1 '13 at 9:32
    
Oops sorry, I meant the one that is on the left side of the admin menu in the dashboard. I'd need it for both admin, authors, contributors... Thanks... –  user27309 Mar 1 '13 at 9:47
    
Add details to the Question itself, you are free to edit it whenever needed. –  brasofilo Mar 1 '13 at 9:53

2 Answers 2

up vote 0 down vote accepted

Here is a simple css display: none function, it just adds some css in the html, if there are more stuff that you want to hide i recommend you to add a new css-file with the function admin_enqueue_scripts

function wpse_remove_collapse() {
   echo '<style type="text/css">#collapse-menu { display: none; visibility: hidden; }</style>';
}
add_action('admin_head', 'wpse_remove_collapse');
share|improve this answer
    
I tried the code by Pontus Abrahamsson and it works like a charm. I've not tried the one by birgire but it appears to work either... Thank you all! –  user27309 Mar 1 '13 at 10:02

You can't use remove_menu() for this one, since it is added like this in the admin menu

    echo '<li id="collapse-menu" class="hide-if-no-js"><div id="collapse-button"><div></div></div>';
    echo '<span>' . esc_html__( 'Collapse menu' ) . '</span>';
    echo '</li>';

in the _wp_menu_output() function in /wp-admin/menu-header.php.

So you could try instead:

function wpse88939_hide_collapse_button_menu() {
        echo "<style>#collapse-menu{display:none !important;} </style>";
}
add_action('admin_head','wpse88939_hide_collapse_button_menu');
share|improve this answer
1  
@Pontus has posted similar solution, while I was writing my answer ;-) –  birgire Mar 1 '13 at 10:01

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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