Solved

How can I hide categories in wp-admin edit page?

Posted on 2011-02-11
2
703 Views
Last Modified: 2012-05-11
I know I can hide categories from the front pages with 'exclude' like this:

<?php wp_list_categories('title_li=&orderby=id&hide_empty=0&exclude=1,13,78,79,3023'); ?>

What I need to do now though, is hide them on the add/edit post pages on the backend. I need to leave these categories in place for legacy... but I want to limit my authors to choosing only the new categories I now have.

Is there a way I can hide those, perhaps something I could put in theme/function.php or something like that?

Thanks,  Chris

0
Comment
Question by:St_Aug_Beach_Bum
2 Comments
 
LVL 17

Accepted Solution

by:
jrm213jrm213 earned 500 total points
ID: 34891566
I don't believe that there is any way to do that through wordpress.  There isn't anything in the database that you denotes if a category is active or has a daterange for the category begin or category end. It would be nice though.

Hover the way that those items are displayed on the page could be changed. In the add/edit post pages those items are listed as

category-id

ie

<li class="popular-category" id="category-9"><label class="selectit"><input type="checkbox" id="in-category-9" name="post_category[]" value="9"> Newletters</label></li>

create a file in your themes folder in a directory called css for example: your-theme/css/hidden-categories.css and in it place the categories you don't want people to choose like below

#category-9, #category-15
{
display: none;
}


then include that css into the site via your themes function.php file. Add this to the bottom of functions.php in your themes file.

wp_register_style('my-style', get_bloginfo( 'stylesheet_directory' ) . '/css/hidden-categories.css', false, 0.1);
wp_enqueue_style( 'my-style' );

0
 

Author Closing Comment

by:St_Aug_Beach_Bum
ID: 34891809
Brilliant!!!!!!!  Thank you!   Chris
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

WordPress has made it easy to create scalable sites based on their powerful CMS, but as great as WordPress is, there are some SEO issues that haven’t been addressed out of the box.  Fortunately these problems can be solved with a few plugins.  The f…
Do you think that WordPress is just for blogs?  Think again!  WordPress is really a fantastic all around platform that you can use to develop websites on.  Integrated into its basic functionality is the ability to create pages using your choice of a…
The purpose of this video is to demonstrate how to create a Printer Friendly PDF on a WordPress Page. This will be demonstrated using a Windows 8 PC. Tools Used are Photoshop, Awesome Screenshot” Google Chrome Extension, and SmallPDF.com Log…
The purpose of this video is to demonstrate how to Test the speed of a WordPress Website. Site Speed is an important metric of a site’s health. Slow site speed can result in viewers leaving your site quickly and not seeing your content. This…

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now