0

I'm trying to remove these areas from one of my custom taxonomies.

enter image description here

enter image description here

I've built them using the two plugins: Custom Post Types UI (to add them) and Advanced Custom Fields (to add fields to the taxonomy).

I can't see anything in the plugin settings to remove these things, but I'm not sure if I'm missing something.

I'm assuming I might need to add a function to the functions.php file. I've seen that hiding things using jQuery is a possibility, but I hear that this might show it initially on load and then hide it, so id like to learn how to doit properly.

Shaun Taylor
  • 932
  • 2
  • 16
  • 43
  • 1
    https://wordpress.stackexchange.com/questions/217932/hide-the-term-description-on-the-term-edit-page-for-a-given-taxonomy – disinfor Mar 16 '22 at 15:28
  • Thank you - It didn't quite provide everything I needed but I've posted the exact solution below. – Shaun Taylor Mar 16 '22 at 15:49

2 Answers2

0

I managed to get there with the link above and help from another website.

This function removed the two instances of the 'description' box:

function hide_description_row() {
    echo "<style> .term-description-wrap { display:none; } </style>";
}

add_action( "measure_sectors_edit_form", 'hide_description_row');
add_action( "measure_sectors_add_form", 'hide_description_row');

and this one removed the column from the right hand side:

add_filter('manage_edit-measure_sectors_columns', function ( $columns ) {
    if( isset( $columns['description'] ) )
        unset( $columns['description'] );   
    return $columns;
});

To use with other taxonomies, just replace 'measure_sectors' with your own taxonomy slug

Shaun Taylor
  • 932
  • 2
  • 16
  • 43
  • I think this will lead to invalid html, as the `style` tag is just somewhere within the `body`. -> https://stackoverflow.com/questions/2830296/using-style-tags-in-the-body-with-other-html – Merc Jun 08 '23 at 12:29
0

I would propose another solution.


function add_custom_taxonomy_css()
{
  wp_enqueue_style(
    "custom-taxonomy",
    get_stylesheet_directory_uri() . "/custom-taxonomy.css"
  );
}

add_action("exhibitions_edit_form", "add_custom_taxonomy_css");
add_action("exhibitions_add_form", "add_custom_taxonomy_css");

and custom-taxonomy.css

/*
 * hiding taxonomy description
 */

.term-description-wrap {
  display: none;
}

This has, in contrast to the other solution, the advantage, that we still get valid HTML, because we have no stray <style> tags within our <body>.

Merc
  • 4,241
  • 8
  • 52
  • 81