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.

How can I remove the category/taxonomy description field? The one which shows up on the edit category/taxonomy page.

share|improve this question

4 Answers 4

up vote 5 down vote accepted

When no hook is available, you can always count on the old jQuery trickery...

add_action( 'admin_footer-edit-tags.php', 'wpse_56569_remove_cat_tag_description' );

function wpse_56569_remove_cat_tag_description(){
    global $current_screen;
    switch ( $current_screen->id ) 
    {
        case 'edit-category':
            // WE ARE AT /wp-admin/edit-tags.php?taxonomy=category
            // OR AT /wp-admin/edit-tags.php?action=edit&taxonomy=category&tag_ID=1&post_type=post
            break;
        case 'edit-post_tag':
            // WE ARE AT /wp-admin/edit-tags.php?taxonomy=post_tag
            // OR AT /wp-admin/edit-tags.php?action=edit&taxonomy=post_tag&tag_ID=3&post_type=post
            break;
    }
    ?>
    <script type="text/javascript">
    jQuery(document).ready( function($) {
        $('#tag-description').parent().remove();
    });
    </script>
    <?php
}
share|improve this answer
    
Thanks. This works, although I had to add #description to get it to remove the field from the edit category/taxonomy page as well. That feels a bit unsafe though, as anything with ID of description will get removed. Can I be more specific in my targeting? I´m not sure how myself. –  Johan Dahl Jun 26 '12 at 14:45
1  
Well, the script is only being printed in the edit-tags.php pages. Just checked and as expected only one div with those ID's exist in each page. But I'm adding an extra code to my answer so you are sure of what page you're actually in, tags or categories. –  brasofilo Jun 26 '12 at 15:07
    
Thanks a bunch! –  Johan Dahl Jun 26 '12 at 17:53

AFAIK, you can add new fields but you cannot remove the old ones! They are directly printed, and not stored in a variable to which a filter can be applied. Ref: wp-admin/edit-tags.php, line no. 380.

share|improve this answer
    
Ok, to bad. Have to use the jQuery method above then I guess. Thanks. –  Johan Dahl Jun 26 '12 at 14:43
    
You're welcome, the jQuery trick will work fine! –  Rutwick Gangurde Jun 27 '12 at 8:59

I used the jQuery below to achieve this as well.

$('label[for="description"]').parent().parent().remove(); 
share|improve this answer

On the Edit Category/Taxonomy page, .parent() doesn't remove the form field's label. Here's the jQuery for complete removal on both pages:

$('#tag-description').closest('.form-field').remove();
$('#description').closest('.form-field').remove();
share|improve this answer

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.