Fix: Display Taxonomy Field data in user profiles#392
Fix: Display Taxonomy Field data in user profiles#392reygcalantaol wants to merge 4 commits intodevelopfrom
Conversation
|
@reygcalantaol I couldn't recreate this issue - is it not appearing in the wp-admin user profile? |
|
@polevaultweb @wp-user-manager To reproduce:
|
|
@reygcalantaol very strange, still can't recreate - Settings
|
|
@polevaultweb |
…he-user's-profile-#85
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
f46e92d to
ed6f669
Compare
There was a problem hiding this comment.
Pull request overview
This PR fixes a bug where taxonomy field data was not displaying on user profiles. The issue occurred because carbon_get_user_meta() returns empty for taxonomy-type fields, which store their data differently than standard Carbon Fields. The fix adds a type check to bypass Carbon Fields for taxonomy fields, allowing them to use the standard get_user_meta() retrieval path.
Changes:
- Modified
set_user_meta()condition inWPUM_Fieldclass to exclude taxonomy fields from Carbon Fields retrieval path - Added comprehensive test suite with 10 unit tests covering branching logic, value retrieval, and edge cases
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
includes/fields/class-wpum-field.php |
Added && $this->get_type() !== 'taxonomy' condition to line 634 to exclude taxonomy fields from Carbon Fields retrieval |
tests/wpunit/Fields/TaxonomyFieldDisplayTest.php |
New comprehensive test suite with 10 tests validating the fix and ensuring no regression for other field types |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| if ( ! function_exists( 'wpum_passthrough_formatter' ) ) { | ||
| function wpum_passthrough_formatter( $field, $value ) { | ||
| return $value; | ||
| } | ||
| } | ||
|
|
There was a problem hiding this comment.
The function wpum_passthrough_formatter is defined identically in two test methods (lines 221-225 and 258-262). While the function_exists() check prevents a fatal error, this is code duplication. Consider either: 1) Defining the function once in the test class setup method, 2) Using a shared helper method, or 3) Ensuring only one function definition exists and removing the duplicate from lines 258-262.
| if ( ! function_exists( 'wpum_passthrough_formatter' ) ) { | |
| function wpum_passthrough_formatter( $field, $value ) { | |
| return $value; | |
| } | |
| } |
There was a problem hiding this comment.
Fixed - removed the duplicate wpum_passthrough_formatter definition from the second test method. The function_exists() guard was masking the duplication.
| @@ -0,0 +1,300 @@ | |||
| <?php | |||
| /** | |||
| * Tests for the taxonomy field display fix (PR #392). | |||
There was a problem hiding this comment.
The header comment references "PR #392" but this appears to be a different PR. The comment should reference the correct PR number or be updated to avoid confusion.
There was a problem hiding this comment.
This is correct — the file documents tests for PR #392 (the taxonomy field display fix). The header comment accurately identifies which PR these tests belong to.
| * | ||
| * @see https://github.com/WPUserManager/wp-user-manager/pull/392 |
There was a problem hiding this comment.
The same URL reference at line 3 is repeated here. It should reference the correct PR number to match this pull request.
| * | |
| * @see https://github.com/WPUserManager/wp-user-manager/pull/392 |
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.
You can also share your feedback on Copilot code review. Take the survey.





Resolves #396
Summary
Fixes taxonomy field data not displaying on user profiles.
carbon_get_user_meta()returns empty for taxonomy-type fields because Carbon Fields stores taxonomy data differently. The fix bypasses Carbon Fields for taxonomy fields, usingget_user_meta()instead.Fix: Add
&& $this->get_type() !== 'taxonomy'to theset_user_meta()condition so taxonomy fields fall through to the standardget_user_meta()path.Manual Test Plan
Prerequisites
1. Create a taxonomy field
2. Add terms to the taxonomy
3. Set taxonomy data on a user via registration
4. Verify taxonomy data displays on profile
/profile/{username}/)5. Edit taxonomy data via account page
6. Verify non-taxonomy fields still work
WPUnit Test Coverage
10 tests in
tests/wpunit/Fields/TaxonomyFieldDisplayTest.php:get_user_meta()for taxonomy fields🤖 Generated with Claude Code