1

I need to remove description textarea from a custom taxonomy edit screen in admin.

I'm actually doing this with the following jQuery line

$('.form-field.term-description-wrap').remove();

but I would like doing it in PHP. Is it possible?

I'm looking at the {$taxonomy}_edit_form_fields hook. Is this the right one? If so which lines of code should I add into the callback function?

1

check out this thread - I'm afraid nothing has changed since then, there is still no way of filtering the description field (it's just html hardcoded in the file https://github.com/WordPress/WordPress/blob/master/wp-admin/edit-tags.php#L484, so you can't remove it with php without editing the core files, which is never a right way to go).

The hook you're using, {$taxonomy}_edit_form_fields is fired on single term edit screen before the standard fields are printed, so you can use it to add something more, but not for filtering standard fields.

I'd say you need to hold on to your JS solution for now or even better - go with CSS display: none; solution to make sure the field doesn't show up when JavaScript is disabled and to avoid flickering, like mentioned here.

0

It's not possible, there's no hook. The hook you mentioned is an action, not a filter, and can just be used to add fields or perform actions after the existing form fields are output, not modify existing fields/output.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.