-
Notifications
You must be signed in to change notification settings - Fork 4.4k
Fix: Update post-publish panel to use taxonomy label instead of hardcoded "Tags" #70410
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
…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_tag
taxonomy 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_tag
filter 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.name
from the core data store viauseSelect
and using it in all strings viasprintf()
.How?
useSelect
call to get thename
label of thepost_tag
taxonomy.sprintf()
calls that dynamically insert the taxonomy label.Testing Instructions
Screenshots or screencast
Before
After