Learn
Learn copied to clipboard
Standardise taxonomies across post types
See #1009
This PR sets up the new taxonomies we will be using across all post types:
- A new
wporg_languagetaxonomy to be populated with all the possible locales - Extends the
topictaxonomy (currently only applied to tutorials) to all post types
Once these are in place we can start migrating all the post content to use them:
- Lesson plan
category->topic - Tutorial
video_languagemeta field ->wporg_language - Course
course-category->topic
After that the old taxonomies and meta fields can be removed (or possibly hidden from the UI if there is any value in keeping them around).
A number of frontend tasks will then follow to switch filters and queries to use the new taxonomies.
Screenshots
Admin tables
| Lesson Plans | Languages |
|---|---|
![]() |
![]() |
Posts
| Lesson Plan | Tutorial |
|---|---|
![]() |
![]() |
How to test
- Load the admin and check that Lesson Plans, Tutorials, Meetings and Courses all have Topic and Language taxonomies.
- Edit different post types adding Languages (see screenshots above for proposed data), and Topics (should already be plenty of terms from Tutorials).
- Smoke test frontend after adding new terms to post content.
Sorry for un-approving, but I went back to the original locale PR. In #112, the wporg locales plugin was added to handle generating the locale names based on the standardized languages set in GlotPress (see pub/locales.php & pub/locales/locales.php). This is kept up to date with the GlotPress projects, so when new languages are added (or if a language name updates), they're populated throughout the site. If the language is added as a separate taxonomy here, it will probably become unsynced from that list at some point.
I also found the code I was thinking of when we spoke in slack – in wporg_archive_query_prioritize_locale, the language is used to sort workshops.
In order to show all workshops, but with the ones that are presented/captioned in the user's locale shown first, we need to modify the posts query in ways that can't be done through the WP_Query or WP_Meta_Query APIs. Instead, here, we're filtering the individual clauses of the query to add the pieces we need.
I'm not sure if it's working, or if you want it to keep working this way, but the way the taxonomy tables are set up would make this impossible (or at least much more complex).
You might be better off trying to expand the current language meta to the other post types after all.
I'm not sure if it's working, or if you want it to keep working this way, but the way the taxonomy tables are set up would make this impossible (or at least much more complex).
Yeah I think this is something I don't want to mess with! Thanks for alerting me to this.
@hlashbrooke here is the use case for sorting by language. I think we should change tack and add more meta fields to the other post types using the same code.
UPDATE: The Language taxonomy has now been dropped in favour of a new language meta field available on all post types. This is visible as a column on the admin tables and is editable via a post setting:

This can be tested by editing, refreshing and returning to the admin table. meeting needs to be tested in sandbox.
NOTE: Tutorials already have a video_language meta field so that hasn't been touched. Next step for this is to migrate the data from the old field to the new and then update all the filtering and querying references to use the new field.



