Solved

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

Posted on 2011-02-11
2
708 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

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I want to start by talking about the use of plug-ins for WordPress. I started a web-site for a company I was working for a few years ago; I had extremely basic knowledge of HTML. I am a Graphic Designer by trade so I invited the opportunity as a cha…
WordPress can be pretty daunting, especially for a beginner, so I thought it might be a good idea to write an article to show how easy it is to get started in WordPress and to design a custom theme.  The first step is to check with your hosting comp…
The purpose of this video is to demonstrate how to manually back up a WordPress Database. This will be demonstrated using a Windows 8 PC. The Host used will be IPage.com Log into your Hosting account. IPage will be used for demonstration : Locat…
The purpose of this video is to demonstrate how to update a WordPress Site’s version. WordPress releases new versions of its software frequently and it is important to update frequently in order to keep your site secure, and to get new WordPress…

831 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