Used labels provided by the rest API on taxonomies.#4767
Used labels provided by the rest API on taxonomies.#4767jorgefilipecosta merged 1 commit intomasterfrom
Conversation
There was a problem hiding this comment.
Minor: The array notation for the get function is a little bit more performant per @aduth's advice ;)
get( this.props.taxonomy, [ 'data', 'labels', 'singular_name' ] )
There was a problem hiding this comment.
Any reason to use - %s - here? Is this how it's done in the old editor?
There was a problem hiding this comment.
Exactly I ported the behavior from the old editor.
fb8ee52 to
461e0ac
Compare
That's strange I'm not being able to replicate this problem. I will look further to check if I find the cause. |
| const noParentOption = slug === 'category' ? _x( 'None', 'category' ) : _x( 'None', 'term' ); | ||
| const newTermSubmitLabel = slug === 'category' ? __( 'Add Category' ) : __( 'Add Term' ); | ||
| const { labels } = taxonomy.data; | ||
| const newTermButtonLabel = labels.add_new_item; |
There was a problem hiding this comment.
Would we want a fallback value to be shown in the case that the data is not loaded yet?
9fec641 to
d983b3a
Compare
|
Hi @youknowriad, this suffered some changes, can you confirm if in your tests taxonomies are still not being shown? |
youknowriad
left a comment
There was a problem hiding this comment.
Seems to work well now 👍
|
(you might want to check the tests) |
Until now we were using hardcoded values.
d983b3a to
9ef4742
Compare

This uses labels provided by the rest API on taxonomies. Until now we were using hardcoded values.
This made labels like "Add new gender" on custom taxonomies useless and instead "Add new term" was used.
How Has This Been Tested?
Verify categories and tags work as expected.
Add a new taxonomy with custom labels and verify correct labels are used. (easily done with a plugin like Custom Post Type UI)