admin管理员组

文章数量:1122832

I have a custom post type (FAQs), taxonomy (FAQ Categories) and everytime I want to create one it appears all the same name, slug, parent, description fields. I was wondering... If there is a possibility I could override, for example, the 'Name' input bottom label?

I have a custom post type (FAQs), taxonomy (FAQ Categories) and everytime I want to create one it appears all the same name, slug, parent, description fields. I was wondering... If there is a possibility I could override, for example, the 'Name' input bottom label?

Share Improve this question asked Aug 23, 2024 at 15:35 neke90neke90 11 bronze badge 1
  • After building countless custom plugin functions to manage taxonomy meta, I've found ACF plugin to be so much easier. Not selling anything here, just saying sometimes it's worth paying for a good premium plugin and ACF is excellent. You can edit custom meta details for each taxonomy and also customize the main "name" field using filters. – Simon Commented Aug 26, 2024 at 5:56
Add a comment  | 

1 Answer 1

Reset to default 0

There's a filter for taxonomy labels, taxonomy_labels_{$taxonomy} (the {$taxonomy} should be replaced with your custom taxonomy name) that allows you to filter pretty much all of it.

Example:

// Assuming your custom taxonomy is named 'faq_category'. Adjust as needed.
add_filter( 'taxonomy_labels_faq_category', 'wpse626542_taxonomy_labels' );
/**
 * Filters the taxonomy labels.
 *
 * @param  object $labels The taxonomy labels.
 * @return object         The filtered labels.
 */
function wpse426542_taxonomy_labels( $labels ) {
    // Changes the label on the Name field.
    $labels->name_field_description = __( 'My Custom Name Description', 'my-plugin' );
    // Change any other labels you want, and then...
    return $labels;
} 

A full list of the labels can be found in the get_taxonomy_labels() docs.

本文标签: Is there a way to edit noncustom term attributes