Skip to content

Conversation

adalpari
Copy link
Contributor

@adalpari adalpari commented Oct 2, 2025

Description

This PR implements dynamic taxonomies display in the site settings menu based on server configuration. The system fetches taxonomy information from self-hosted WordPress sites and shows only those taxonomies that are configured to appear in navigation menus.

Important note: Categories and Tags are the only supported taxonomies until we build the TaxonomyDataView. So, the current screen calls are hardcoded.

Testing instructions

  1. Log into a WP.com site
  2. Go to "Site Settings"
  • Verify you see "Categories" and "Tags"
  1. Log into a self-hosted site using the XML-RPC flow
  2. Go to "Site Settings"
  • Verify you DON'T see "Categories" and "Tags"
  1. Set up Applcation Password for the site
  • Verify you DO see "Categories" and "Tags"
Screen.Recording.2025-10-02.at.18.15.57.mov

@dangermattic
Copy link
Collaborator

dangermattic commented Oct 2, 2025

2 Warnings
⚠️ strings.xml files should only be updated on release branches, when the translations are downloaded by our automation.
⚠️ PR is not assigned to a milestone.

Generated by 🚫 Danger

Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR implements dynamic taxonomies display in the site settings menu based on server configuration. The system fetches taxonomy information from self-hosted WordPress sites and shows only those taxonomies that are configured to appear in navigation menus.

  • Adds a new ViewModel to fetch and filter taxonomies from the WordPress API
  • Updates the site settings UI to dynamically display taxonomy preferences based on server response
  • Removes hardcoded writing section preferences in favor of dynamic taxonomy handling

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
strings.xml Adds "Taxonomies" title string for the new preference section
key_strings.xml Adds preference key for taxonomies section
TaxonomiesNavMenuViewModel.kt New ViewModel that fetches taxonomies and filters by nav menu visibility
SiteSettingsFragment.java Integrates taxonomy fetching and dynamically creates preference UI
ViewModelModule.java Registers the new ViewModel for dependency injection

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@wpmobilebot
Copy link
Contributor

wpmobilebot commented Oct 2, 2025

Jetpack📲 You can test the changes from this Pull Request in Jetpack by scanning the QR code below to install the corresponding build.
App NameJetpack Jetpack
FlavorJalapeno
Build TypeDebug
Versionpr22255-b3e623b
Commitb3e623b
Direct Downloadjetpack-prototype-build-pr22255-b3e623b.apk
Note: Google Login is not supported on these builds.


private BloggingRemindersViewModel mBloggingRemindersViewModel;

private TaxonomiesNavMenuViewModel mTaxonomiesNavMenuViewModel;

Check notice

Code scanning / Android Lint

Nullable/NonNull annotation missing on field Note

Missing null annotation
@wpmobilebot
Copy link
Contributor

wpmobilebot commented Oct 2, 2025

WordPress📲 You can test the changes from this Pull Request in WordPress by scanning the QR code below to install the corresponding build.
App NameWordPress WordPress
FlavorJalapeno
Build TypeDebug
Versionpr22255-b3e623b
Commitb3e623b
Direct Downloadwordpress-prototype-build-pr22255-b3e623b.apk
Note: Google Login is not supported on these builds.

@adalpari adalpari marked this pull request as ready for review October 3, 2025 09:00
Copy link

codecov bot commented Oct 3, 2025

Codecov Report

❌ Patch coverage is 92.00000% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 39.93%. Comparing base (33d22f3) to head (b3e623b).

Files with missing lines Patch % Lines
.../ui/prefs/taxonomies/TaxonomiesNavMenuViewModel.kt 92.00% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##            trunk   #22255      +/-   ##
==========================================
+ Coverage   39.91%   39.93%   +0.01%     
==========================================
  Files        2165     2166       +1     
  Lines      102511   102536      +25     
  Branches    14771    14774       +3     
==========================================
+ Hits        40922    40945      +23     
- Misses      58122    58123       +1     
- Partials     3467     3468       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Base automatically changed from task/CMM-808-port-categories-and-tags-to-the-new-generic-wordpress-rs-endpoint to trunk October 3, 2025 12:18
@adalpari adalpari requested a review from a team as a code owner October 3, 2025 12:18
Copy link
Member

@dcalhoun dcalhoun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code looks good. Test plan succeeded for me. That said...

This PR implements dynamic taxonomies display in the site settings menu based on server configuration. The system fetches taxonomy information from self-hosted WordPress sites and shows only those taxonomies that are configured to appear in navigation menus.

Why do we toggle visibility in the app based upon show_in_nav_menus? My perception is that this property is used for controlling taxonomy visibility when creating WordPress menus rendered on a site's front end. Is my understanding incorrect?

An aside: this currently includes changes from #22252 due to the stacked branch and recent merge. Unsure if it is worth rebase or not.

@adalpari
Copy link
Contributor Author

adalpari commented Oct 3, 2025

An aside: this currently includes changes from #22252 due to the stacked branch and recent merge. Unsure if it is worth rebase or not.

My bad because of wrong targeting. Fixed!

Copy link

sonarqubecloud bot commented Oct 3, 2025

@adalpari
Copy link
Contributor Author

adalpari commented Oct 3, 2025

Why do we toggle visibility in the app based upon show_in_nav_menus? My perception is that this property is used for controlling taxonomy visibility when creating WordPress menus rendered on a site's front end. Is my understanding incorrect?

If I understood it correctly, we don't want to show all the given taxonomies if the visibility setting is set to false. I see now that I might be using showAdminColumn instead of showInNavMenus?

Related question to @jkmassel too:

On https://cpt.wpmt.co/wp-admin/ I don't see Categories and Tags, but the response when requesting taxonomies doesn't contain any false value on any of those fields. Neither showAdminColumn nor showInNavMenus

Screenshot 2025-10-03 at 15 26 53

@jkmassel
Copy link
Contributor

jkmassel commented Oct 3, 2025

Why do we toggle visibility in the app based upon show_in_nav_menus? My perception is that this property is used for controlling taxonomy visibility when creating WordPress menus rendered on a site's front end. Is my understanding incorrect?

@adalpari is correct – not all taxonomies are user-facing, and custom-registered ones might deliberately not want to be.

We want to match the behaviour of wp-admin as much as possible, which this will do.

@dcalhoun
Copy link
Member

dcalhoun commented Oct 3, 2025

Thank you for elaborating.

I understand and agree with the desired outcome. However, my understanding from register_taxonomy() documentation is that show_in_menu and show_ui control taxonomy visibility in the WP Admin menu (sidebar); not show_in_nav_menus, which controls Appearance → Menus specifically. Am I mistaken?

@adalpari
Copy link
Contributor Author

adalpari commented Oct 3, 2025

Thank you for elaborating.

I understand and agree with the desired outcome. However, my understanding from register_taxonomy() documentation is that show_in_menu and show_ui control taxonomy visibility in the WP Admin menu (sidebar); not show_in_nav_menus, which controls Appearance → Menus specifically. Am I mistaken?

I think you are right. I'll go with those ones.
Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants