How to get WordPress Username in Array format

Posted by Prem Tiwari | Updated on

The other answers are correct, but it’s possible to achieve the same thing with less code using wp_list_pluck():

wp_list_pluck() used that way will get the display_name field of all the users in an array without needing to do a loop.


If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.

Related Questions & Answers