Fix: Update post-publish panel to use taxonomy label instead of hardcoded "Tags"#70410
Conversation
…ng in Maybe tags panel
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the Unlinked AccountsThe following contributors have not linked their GitHub and WordPress.org accounts: @ShreyaShrivastava@192.168.1.12, @lakrisgubben. Contributors, please read how to link your accounts to ensure your work is properly credited in WordPress releases. If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
t-hamano
left a comment
There was a problem hiding this comment.
Thanks for the PR!
I think we should respect the add_new_item field instead of using the taxonomy name itself.
Example:
const Test = () => {
const taxonomyLabels = useSelect( ( select ) => {
const taxonomy = select( coreStore ).getTaxonomy( 'post_tag' );
return taxonomy?.labels;
}, [] );
return taxonomyLabels?.add_new_item ?? __( 'Add tag' );
};|
@t-hamano thanks for the review! Yeah, that makes sense. I changed the code to use add_new_items like so -
Do you think it'll be better to convert |
I don't recommend controlling the character case programmatically because it won't work properly in non-English locales. Additionally, I don't need to use |
…oded "Tags" (WordPress#70410) * refactor: use tags taxonomy name label instead of hardcoded tags string in Maybe tags panel * refactor: use add_new_item instead of name for taxonomy label * refactor: use add_new_item label for panel title * i18n: add i18n for static labels --------- Unlinked contributors: shreyashrivastava@192.168.1.12, lakrisgubben. Co-authored-by: shrivastavanolo <shreya0shrivastava@git.wordpress.org> Co-authored-by: yogeshbhutkar <yogeshbhutkar@git.wordpress.org> Co-authored-by: t-hamano <wildworks@git.wordpress.org> Co-authored-by: jorgefilipecosta <jorgefilipecosta@git.wordpress.org> Co-authored-by: kathrynwp <zoonini@git.wordpress.org> Co-authored-by: skorasaurus <skorasaurus@git.wordpress.org>



What?
Fixes #22588
Updates the MaybeTagsPanel component in the post-publish panel to use the dynamic taxonomy label for the
post_tagtaxonomy instead of hardcoded strings like "Tags".Why?
Previously, the post-publish panel used hardcoded "Tags" strings in its UI, even if the
taxonomy_labels_post_tagfilter was used to rename the taxonomy (e.g., to "Keywords"). This led to inconsistencies between the main editor sidebar (which showed the correct custom label) and the pre-publish panel (which did not).This PR resolves that by fetching the
labels.namefrom the core data store viauseSelectand using it in all strings viasprintf().How?
useSelectcall to get thenamelabel of thepost_tagtaxonomy.sprintf()calls that dynamically insert the taxonomy label.Testing Instructions
Screenshots or screencast
Before
After