Remove the category/taxonomy description field?
How can I remove the category/taxonomy description field? The one which shows up on the edit category/taxonomy page.
Topic description taxonomy categories Wordpress
Category Web
How can I remove the category/taxonomy description field? The one which shows up on the edit category/taxonomy page.
Topic description taxonomy categories Wordpress
Category Web
I guess this would be a good answer
add_filter('manage_edit-product_cat_columns', function ( $columns ) {
if( isset( $columns['description'] ) )
unset( $columns['description'] );
return $columns;
} );
The most efficient way of 'removing' it is to apply CSS to the admin area, by using the 'admin_head' action hook.
add_action('admin_head', 'my_admin_area_custom_css');
function my_admin_area_custom_css() {
echo '<style>
body.taxonomy-name .term-description-wrap {
display:none;
}
</style>';
}
NB: Update the body.taxonomy-name
to the taxonomy name you wish to hide the description field for.
There is not a hook to remove the markup from the document, hence hiding it with CSS.
Use CSS, I was implementing the JS solution and I didn't like the delay, then I've remembered about this.
body.taxonomy-name .term-description-wrap {
display:none;
}
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();
I used the jQuery below to achieve this as well.
$('label[for="description"]').parent().parent().remove();
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
}
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.
Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.