Skip Navigation

[Resolved] No results found in Users View when sorting by custom field

This thread is resolved. Here is a description of the problem and solution.

Problem: My Users View shows "no results found" when sorting by a custom field.

Solution: WordPress has a quirk when sorting by a custom field. If the User (or post or term) does not have a value for that custom field, it will not be part of the results.

This support ticket is created 6 years, 8 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

Author
Posts
#629730
Schermafbeelding 2018-03-29 om 16.48.44.png
Schermafbeelding 2018-03-29 om 16.46.56.png

Hi!

I'm trying to display custom user fields of user with a custom role "docent" (translated means teacher) . The query is set to display user data of a certain type of user (the custom role 'teacher').

The output remains 'no items found' however.

I configured a custom role 'teacher' with the acces plugin. It has custom fields to display which are assigned the this role only.

Am I overlooking something?

#629767

Hi, please check the "sortby" setting for this View. It looks like you have selected to sort by a custom User field called "Instrument". Do any of these Docent Users have an Instrument defined in their profile? WordPress sorting behaves a bit strangely - if a User does not include a value for the sortby custom field, the User will not be included in the results.

#629937

Thanks, I totally overlooked this..