Try this code
function get_users(){
$all_users = get_users();
$arr=array();
foreach ($all_users as $val) {
$arr[]=array( 'value'=> $val->data->user_nicename, 'label'=> $val->data->display_name, 'icon' => get_avatar_url($val->ID));
}
wp_send_json($arr);
}
Related Posts:
- How do I change/modify the_post_thumbnail(); html output?
- start_lvl Ignored in Custom walker_nav_menu
- Modify previous and next text from pagination links
- Create a global variable for use in all templates
- Can i check if user is doing any ajax request?
- Calling a method from functions.php on a click of a button
- How can I default to all WordPress roles when parameter is not included in shortcode?
- HTML table from shortcode with multiple parameters
- Placing raw HTML inside a WordPress shortcode
- Slide in Panel WordPress Post
- Shortcode content output but not in correct place
- Add itemprop Schema.org Markup to li Elements in wp_nav_menu
- Removing unneccessary p-tags (Not every p)
- Add a class to the anchor tag on HTML5 gallery
- Where in PHP do I move title and meta (date) to bottom of each blog section?
- Converting HTML Template to WordPress Theme
- Populate dropdown with Child Pages based on Parent Page chosen
- How to store data from multiple forms using ajax and php
- Use DOMDocument with ob_start breaks my HTML code
- Get users that likes the post
- Input data from email form not going to JSON file
- Add .htm extention to a custom taxonomy
- Call to undefined function get_userdata() in plugin
- Noscript not working as it should in wordpress site
- How to make modifications only to certain elements of an HTML string on the server-side?
- Widget back end radio button issue
- entire JS folder not loading in a WP theme
- Adding function to child theme’s function.php
- How to use the checked() function to check for a non-empty var
- Calling function in loop causes repeat data
- How can I use custom menus with a Bootstrap WordPress theme?
- Use of antispambot with $curauth->email
- Uses for function: wp_update_user
- Time Delay a URL Redirect for Specific Page
- how to changes mobile menu toggle breakpoint in WordPress
- WordPress User Meta value variable into Google Gauge Chart
- Change wordpress’ database data using ajax – how to get current user id?
- Allow a user or role to view drafts and previews, but not other admin privileges?
- Adding HTML Code to Replace Text in PHP
- PHP function for horizontal Woocommerce thumbnails and badges
- Get current user id in function php
- How to use data URL in WordPress?
- HTML comment cause issue in functions.php script root
- Remove span tags from WooCommerce Downloads page
- If user has clicked link add class and store using PHP/WordPress
- Display current user metadata on WordPress page
- How to center all text body in single.php at once?
- How can I get my pagination loop to display the correct number of total pages?
- Add another role to a user when they click a button?
- is_user_logged_in() not working in homepage
- Show post/page into div using function
- Matching multi user
- Private messaging – Getting and displaying the avatar/url of a message recipient
- main menu page redirects to user ID
- WordPress HTML Helper
- Get author meta of all writers
- Cant get theme to change footer color through theme customizer
- Display a list of users with avatar filterable with alphabets
- Cross origin ajax request always returns 0 when calling get_current_user_id();
- Sorting Problem
- Add multiple HTML attributes to an Elementor button
- How to enqueue structured data as file – jsonld file seems not to work
- Custom Navigation Bar JSON Syntax Error in JSON at Position 0
- Custom Admin Menu Report for Specific User ID
- How can we upload custom page files?
- How can I process a form submission from an HTTP POST request?
- How to use return in my custom function instead of echo
- Differences when using the the_time and the_date functions
- Create Logout Link WordPress Admin Menu
- Word Count Function Preventing Permalink Editing
- Add a Second Menu to a theme that only support 1 menu
- How to speed up a wordpress function with multiple loops?
- How to Display Image Meta underneath EVERY image in EVERY post
- Custom excerpt function re-factoring
- Warning: Use of undefined constant HTTP_USER_AGENT – assumed ‘HTTP_USER_AGENT’ (this will throw an Error in a future version of PHP)
- PHP can I add line numbers to file_get_contents()
- Adding tawk.to code just before body tag on functions.php file
- How to change a public function inside a class of a plugin?
- get_the_terms – only top level
- syntax issue on php 7.4
- How do I fetch all comments per post via WP REST API?
- How do I publish only one page to production after making changes on staging?
- Have CSS Class Added with `is_page()` WP function
- Changing Woocommerce flat rate every nth number of items
- Use wp_get_recent_posts with search term
- Convert all images to PNG on file upload
- How to restrict page access to logged-in users?
- Remove query string specific key value
- is_page “range” for if statement?
- Correct syntax to html php conversion
- Calculations in functions.php [closed]
- If search results empty then execute certain code
- Create dynamic pages from external JSON data without storing in Database?
- An unwanted inline style is added to my body tag
- Shortcode return function with link href inside PHP
- Parsing php string in jquery [closed]
- How to properly insert a link to a template in WordPress?
- Can’t load WP function into external function
- Upload Image in a WordPress page using PHP
- Count the number of times the search form template gets included on a page