Try this one:
function prefix_get_users(){
$args=array(
'blog_id' => $GLOBALS['blog_id']
);
$all_users=get_users($args);
$arr=array();
foreach ($all_users as $val) {
$arr[]=$val->data->user_nicename;
}
die(json_encode( $arr ));
}
Reference: https://codex.wordpress.org/Function_Reference/get_users
Related Posts:
- start_lvl Ignored in Custom walker_nav_menu
- Enforcing password complexity
- Allowed memory size of 268435456 bytes exhausted (tried to allocate 7146491840906359738 bytes)
- How do I make my function add variables/values to the $post object?
- Check if a menu is empty?
- How do I get the author’s page url from their ID?
- Calculate percentage of post by category
- Dynamically change feature image in customiser
- Change comments form title on a page by page basis
- Creating wordpress user registration form
- Get the title before comma
- category not display in word press grammatically
- Getting a fatal error while updating
- How do I know what variables are passed in a filter/action and what their meaning is?
- “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
- Wrap each shortcode in array to div
- Warning: array_pop() expects parameter 1 to be array, boolean given
- Check if Product is in a Specific Category in Functions.php
- How to Display Image Meta underneath EVERY image in EVERY post
- get_the_terms – only top level
- Have CSS Class Added with `is_page()` WP function
- Slide in Panel WordPress Post
- Limiting woocommerce line_total decimal length
- Run a filter when a walker runs
- comments_number display outside specified span
- Swapping wp_dropdown_categories function with wp_category_checklist
- Display fields as values in array from external SQL DB
- Passing the custom field values in the wp_get_current_user array function
- Populate dropdown with Child Pages based on Parent Page chosen
- How can I remove a function that has been added to wordpress with add_filter?
- Get value from shortcode to do something
- PHP 8, AJAX mail form to function.php doesn’t work
- Ajax request not sending to server and returning – wp-admin/admin-ajax.php 400
- Custom shortcode outputs plain text instead of HTML at top of post
- how can i use $_COOKIE[] + PostID to execute the below code?
- What’s the uses of wp_cache_set() or wp_cache_add()?
- How to create a php variable using WordPress the_title() function
- Create Page To Count Comments For Each Post In WordPress Site
- Can’t find infinite loop cause
- how to make custom ajax handler?
- How to disable controls in theme customizer?
- is there a benefit in using a constant over get_stylesheet_directory_uri?
- Can i put my shortcode inside a variable in php files?
- Moving code from theme header to functions.php
- Best way to use a large array in function
- Setting user nickname and displayname to shortened email
- Download PDF after CF7 form submission
- ::before on open/close function [closed]
- REQUIRED: get_bloginfo(‘template_url’) was found in the file search.php. Use get_template_directory_uri() instead
- How to check if a PHP string is different than meta field?
- Creating a mobile site by adding a new class to the body tag from functions.php
- Upload multiple files in randomly generated folder using wp_upload_bits
- Export Form Data to a CSV then send it as an attachment – contact form 7
- Issue with fetching mysql data and displaying results via shortcode in webpage
- Personalize checkout text
- How do I create a function that modifies a message in the wp-login.php file?
- Cant display an image via PHP in wordpress
- Template Loop – add switch case php
- Show all tags within a category?
- Call to undefined function error in plugin
- How do I correct the code in php? [closed]
- Image rotation issue (horizontal picture uploading as vertical) — Exif issue?
- Creating customized php files in theme folder
- Unable to Call More than One Meta Box Output
- How can I alter this code to accept a slug as well as an ID?
- Menu not styling. New menus functionality giving me a headache
- Disclaimer that will show every refresh of the page
- Dynamically switch file in get_template_directory_uri() | Function [closed]
- Adding an “Upgrade Subscription” button to an Elementor page
- Woocommerce My acount page
- Dropdown category field inside repeatable metabox
- Retrieve alt text by referencing the img src
- Custom function that re-writes page title breaks when the Yoast plugin is activated
- Ajax filter with loadmore button
- update_user_meta as multiple value but with same meta key
- Child theme overirde template-tags in a theme built on underscores in inc/template-tags
- Delete post meta by serialized meta value
- Menu not updating for logged in users after redirect
- Create a temporal post
- How to bind each “the_content” elements to a custom variables
- Permalink changes after several minutes after saving post
- Trying to publish a little bit of Javascript on the homepage AND at the bottom
- Add parent menu item in sub-menu in custom nav_walker
- Custom Bulk Actions handler not firing
- Get field in readable word
- Escaping a Single Quote in str_replace for Nav Function
- Private messaging – Getting and displaying the avatar/url of a message recipient
- Display Year and Month from custom field + Age Calculator
- insert thumbnail image from php script
- WordPress rating by views [closed]
- Trying to see if page is category or single and displaying title with appropriate heading tag
- WordPress causing all code to be displayed on line 1. Receiving multiple errors after cleaning cookies and cache
- Fix My Custom Function: Remove Automatic
- WP Debug enabled Undefined index error in a widget
- WP Fatal error: Call to undefined function get_template_directory_uri()
- Remove default Image Sizes
- A better way to write this php function
- how to create twitter card without plugin in wordpress website?