Displaying new user data on the user list page
As new fields are added to user profiles, it can be very useful for site administrators to see this data in the site user list and be able to filter users to only see the ones that were assigned certain values. This recipe shows how to add extra columns to the user listing of the WordPress administration area and add a filter function to reduce the number of records shown.
Getting ready
You should have already followed the Processing and storing custom user data recipe to have a starting point for this recipe. The resulting plugin should still be active on your development site. Alternatively, you can get the resulting code directory (ch8/ch2-private-item-text/*
) from the book's GitHub page and rename ch2-private-item-text-v4.php
to ch2-private-item-text.php
. All other .php
files can be deleted to avoid confusion when activating the plugin.
How to do it...
Follow these steps to display custom user data when managing users...