This seems fairly straight forward, but I cannot find a definite guide on how to add the taxonomy description field to the quick edit box.
I’ve followed several tutorials on adding fields to the custom quick edit box, but the core fields (name, description and slug) do not follow the same guidelines as adding custom fields to the taxonomy quick edit box.
Is it even possible to do so? If not – I guess the best alternate is to create another ‘Description’ meta-field and that way add it to the taxonomy quick edit box.
Normally to add fields to the quick edit field, we should use
'quick_edit_custom_box'
action hook that is triggered only for custom columns, because core columns are explicitly excluded (see code).If we add a custom column, then it will be shown in the list table, but it doesn’t make sense, because the column description is already present.
However, we have the possibility to add an invisible column using 2 tricks:
get_user_option_manageedit-{$taxonomy}columnshidden
filter hookFirst create the invisible column:
Now we have a custom column
'_description'
that is invisible, but can be used to put additional fields via'quick_edit_custom_box'
hook:However, this hook does not pass any current value to pre-fill the field with the current description, but we can use a few lines of jQuery to do that:
Now that we have the form, we need to save data when submitted, pretty easy using
"edited_{$taxonomy}"
hook:Code was quickly tested and seems to work, note that it requires PHP 5.3+.
Just wanted to point out that i was not able to get the code to work without changing the ‘category’ parameter to my custom taxonomy name.
For example:
was replaced with:
Cheers!