feat(tags): add private tags feature#4507
Conversation
There was a problem hiding this comment.
Pull request overview
Adds a “Hidden Tags” capability to Newspack so editors can mark post_tag terms as hidden and have them suppressed across multiple public-facing surfaces and integrations, while remaining available for internal organization in wp-admin.
Changes:
- Introduces
Newspack\Hidden_Tagsto manage hidden-tag term meta, admin UI (Add/Edit/Quick Edit + list table column), and labeling. - Filters frontend/integration outputs to suppress hidden tags (term links, tag cloud, archives/feeds, CSS classes, ad targeting, Yoast schema/sitemaps).
- Loads the new tags module from the main plugin include list.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 8 comments.
| File | Description |
|---|---|
includes/tags/class-hidden-tags.php |
Implements Hidden Tags behavior, admin UI, and frontend/integration filtering. |
includes/class-newspack.php |
Registers the new Hidden Tags module for loading. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Fixed two issues: one where programmatic saves could accidentally clear hidden status, and one where the tag filter was running in wp-admin, plus improvements around internationalization, accessibility, and query performance.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated 5 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
hey Wil, I gave it a first pass today and it's looking great. I want to get back and to a full test, but here's the initial (minor) feedback I have:
|
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 6 out of 7 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 6 out of 7 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 6 out of 7 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 6 out of 7 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 6 out of 7 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 6 out of 7 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Thanks @leogermani!
I've reworded this and it's much clearer now. Thanks!
Great. I wasn't sure what the best practice was on this. Thanks for pointing me in the right direction. The new modifications now follow the approach I spotted in For the wizard integration, I added two filters to This was a bigger change, but it should be helpful to other settings going forward. -- I've updated the PR description and screenshots to reflect these changes. I also worked through the final Copilot review items. |
# Conflicts: # src/wizards/newspack/views/settings/advanced-settings/index.tsx
|
Hey @wil-gerken, good job getting this PR merged! 🎉 Now, the Please check if this PR needs to be included in the "Upcoming Changes" and "Release Notes" doc. If it doesn't, simply remove the label. If it does, please add an entry to our shared document, with screenshots and testing instructions if applicable, then remove the label. Thank you! ❤️ |
|
🎉 This PR is included in version 6.37.0-alpha.1 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
|
🎉 This PR is included in version 6.37.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
All Submissions:
Changes proposed in this Pull Request:
Productizes the private tag concept from Texas Tribune's private plugin into core newspack-plugin.
Gated behind the
NEWSPACK_PRIVATE_TAGS_ENABLEDfeature flag for gradual rollout via Newspack Manager.Carried over from Texas Tribune:
(private)label in the admin tag editor and Gutenberg sidebarNew in this implementation:
post_class/body_classHTML attributesNew Granular settings (Advanced Settings page):
offby default (all behaviors active)newspack_private_tags_settingsoption with input sanitizationArchitecture: Setup Wizard integration
newspack_setup_wizard_settings— allows feature modules to inject non-theme-mod settings into the wizard's REST responsenewspack_setup_wizard_update_setting— allows feature modules to handle saving their own settings, returningtrueto skipset_theme_mod()is_enabled()) lives exclusively inclass-private-tags.php, following the Custom Bylines pattern. The wizard has no direct references toPrivate Tags.Relates to
NPPD-780How to test the changes in this Pull Request:
Setup:
Bauhausand assign it to at least one published post.define( 'NEWSPACK_PRIVATE_TAGS_ENABLED', true );towp-config.php.Admin UI:
Bauhaus, check "Private tag", and save.Bauhaus (private)in the Tags list.Bauhaus.Bauhaus. Confirm the "Private tag" checkbox appears pre-checked. Uncheck it, save, confirm the checkmark disappears. Re-check it via Quick Edit before continuing.Bauhausin the block editor. Confirm the tag appears asBauhaus (private)in the Tags panel.Frontend (all behaviors active — default):
Bauhaus— confirm the tag link does not appear in the post's tag list./tag/bauhaus/— confirm 404./?feed=rss2&tag=bauhaus— confirm 404.tag-bauhausdoes not appear in<body>or article class attributes.Bauhausdoes not appear in it./post_tag-sitemap.xml— confirm no entry for/tag/bauhaus/."keywords"in the JSON-LD block. ConfirmBauhausis not listed.common_targeting. Confirmbauhausdoes not appear in thetagarray.Granular settings:
/tag/bauhaus/— confirm the archive page now loads (not 404).bauhausnow appears incommon_targetingbut is still absent from CSS classes, JSON-LD, etc.Feature flag off:
NEWSPACK_PRIVATE_TAGS_ENABLEDconstant fromwp-config.php.Other information: