How to hide Add New Button on page listing
-
Hi everyone, I hope someone can help. I have trawled the forums and searched everywhere and even though I found a few examples, none have worked for me so far.
How can I hide the Add New button that appears after you click on pages on the left hand menu and it shows a list of pages already created. Add New appears right next to “Pages”. I have a site for a client where they should not add any new pages. I have already changed the user capabilities so that they can’t publish pages but would really like the button to be gone. CSS or a PHP snippet would be great
Any ideas?
-
You can try with this css in admin css:
.wrap .page-title-action{display:none;}Thanks for the tip, where is the admin css? I searched for Admin.css but no specific css file. I did try adding this to my Sparkling theme’s custom css but no luck yet….
Hey,
Try this flow to add css for admin:
http://wordpress.stackexchange.com/questions/110895/adding-custom-stylesheet-to-wp-admin
Thanks for your help pixellanguage, that seemed a bit complicated so I dug a bit deeper and found a solution. The reason the following snippet I found didn’t work is because my current wordpress version has a different class name of .page-title-action (as highlighted by you above – THANKS).
So I took the following snippet which I found previously:
//functions.php or add snippet to "Code Snippets" Plugin function hide_buttons() { global $current_screen; if($current_screen->id == 'page'); { echo '<style>.add-new-h2{display: none;}</style>'; } } add_action('admin_head','hide_buttons');and I replaced it with:
//functions.php or add snippet to "Code Snippets" Plugin function hide_buttons() { global $current_screen; if($current_screen->id == 'page'); { echo '<style>.page-title-action{display: none;}'; } } add_action('admin_head','hide_buttons');So I basically just replaced .add-new-h2 in the first snippet I found with .page-title-action and I would not have even had a clue about this if it wasn’t for your reply, thanks so much.
The solution above removes the Add New button from post and page listings in Admin area – hopefully someone else may find this useful also.
Cool…
The topic ‘How to hide Add New Button on page listing’ is closed to new replies.