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
- What exactly does “Posts page” do in WordPress?
- How do I make my function add variables/values to the $post object?
- Calculate percentage of post by category
- Change comments form title on a page by page basis
- Load custom field value into div with AJAX
- Get the title before comma
- “Can’t use function return value in write context” error
- Display 4 chronological posts starting with a random post
- my function doesn’t return my post from today
- WordPress automatically adds tags when pasting code, how to stop it?
- get_the_terms – only top level
- Run a filter when a walker runs
- Get value from shortcode to do something
- Can’t find infinite loop cause
- Download PDF after CF7 form submission
- Creating a mobile site by adding a new class to the body tag from functions.php
- Is it possible to create new user from external form using REST API?
- Foreach loop inside an array_merge
- Export Form Data to a CSV then send it as an attachment – contact form 7
- Cant display an image via PHP in wordpress
- Template Loop – add switch case php
- Image rotation issue (horizontal picture uploading as vertical) — Exif issue?
- Unable to Call More than One Meta Box Output
- Adding an “Upgrade Subscription” button to an Elementor page
- Retrieve alt text by referencing the img src
- Delete post meta by serialized meta value
- Create a temporal post
- Use WP user status (logged_in) to manage access to independent application
- Escaping a Single Quote in str_replace for Nav Function
- Updating custom user meta
- RegExp to EXCLUDE strip HTML (FOR SOMME) comments
- WordPress causing all code to be displayed on line 1. Receiving multiple errors after cleaning cookies and cache
- How to post data to a word press site in case of a mobile app
- Pass a PHP variable (loop-audio.php) to jQuery function (js/script.js)
- ‘This Field is Required.’ is Not Displaying on CF7 [closed]
- REST API custom endpoints for metaboxes