First of all why you would need custom query for this basic functionality to get users, when WordPress has inbuilt function get_users().
Anyway for custom query, table name is defined as
function custom_func(){
global $wpdb;
$getTest = "SELECT * FROM $wpdb->users LIMIT 1";
$arrayReturned = $wpdb->get_results($wpdb->prepare($getTest));
}
It’s $wpdb->users or $wpdb->post and not $wpdb->wp_users, what you use for a table name, in custom queries.
Also I’ve used the double quotes ” “ for query and not single quotes ‘ ‘, you can read here
Related Posts:
- Delete post revisions on post publish
- Is the regular ajax request method safe or I should use admin-ajax.php?
- Successful or Error Message after running mysql code in functions.php
- Insert all post IDs in new database table
- PHP code inside shortcodes
- WSoD being caused by this piece of code
- How to check if a meta value has already been assigned to any user?
- Multiple meta_key in one global $wpdb;
- Issue with fetching mysql data and displaying results via shortcode in webpage
- How to use mysql LIKE with wpdb?
- making php value numeric
- SQL error with custom query
- Modify WooCommerce used to get all orders in dashboard
- How can I display a query in a page?
- How to set up an auto delete post?
- Allowed memory size of 268435456 bytes exhausted (tried to allocate 7146491840906359738 bytes)
- How to validate WordPress generated password in DB using PHP?
- How do I make my function add variables/values to the $post object?
- How do I get the author’s page url from their ID?
- Calculate percentage of post by category
- Change comments form title on a page by page basis
- Get the title before comma
- the_author_meta not working
- 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
- 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 migrate the posts from an old custom legacy blog to a new WordPress website?
- Adding ads code between comments
- How to create and work with custom data / tables (i.e., for arbitrary data)?
- How to Display Image Meta underneath EVERY image in EVERY post
- Limiting woocommerce line_total decimal length
- Run a filter when a walker runs
- Swapping wp_dropdown_categories function with wp_category_checklist
- Display fields as values in array from external SQL DB
- only show container with next/prev links if they exist?
- 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
- JS file work only in index page
- WP_Query adds “(wp_posts.ID = ‘0’)” so no results are returned
- 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()?
- Long running queries
- Create Page To Count Comments For Each Post In WordPress Site
- How to change menu order item
- responsive.css in the WordPress should be prioritized
- How to display login form anywhere, when user isn’t logged in, without redirecting?
- WordPress member notification
- GET problem in WordPress
- HTML Special Characters in URL string [closed]
- Create page template via functions.php?
- Most commented posts by time period (last 12h, last 24h and etc)
- Send a mail to specific address in a custom field when a new comment is made on a specific post
- CSS change in woo commerce Place Order Text [closed]
- How to unserialize data from MySQL
- Known Issues in WordPress When Upgrading PHP to ver 7
- Warning: call_user_func() expects parameter 1 to be a valid callback, function
- Change MySQL PDO connection to a WPDB connection
- Hide a div when a custom field is empty
- Can’t log in to WordPress wp-admin after adding code to functions.php
- How to change basename url for wp-admin?
- How to exclude meta no index pages from wp_list_pages
- Search by date in WordPress
- Hide a div if the fiels is empty
- Illegal string offset checkbox
- Weird fonts showing which are coming from database
- require get_template_directory() . ‘path/to-my/file.php’ BREAKS customize > themes functionality
- Trying to add some custom text into WordPress Post title via function.php
- Edit a function to take different actions based on user role
- cant insert data in a custom table in phpmyadmin
- I got big white screen when i attach main style sheet of Html in functions.php
- Using Javascript On Page – Header and Footer Now Missing
- Unzip_file causing Media file upload error
- How to generate customized filtered output for the gallery
- Escaping a Single Quote in str_replace for Nav Function
- SQL Query Search page
- Display Year and Month from custom field + Age Calculator
- insert thumbnail image from php script
- WordPress rating by views [closed]
- Get author meta of all writers
- 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
- How to pass username into form that sends data to database
- WP Fatal error: Call to undefined function get_template_directory_uri()
- Remove default Image Sizes
- A better way to write this php function
- PHP Creating a formula from mysql db values and db stored math operator
- How to get a database field value from a WordPress table? [closed]
- Custom WordPress Function – Adding items from Foreach Loop into an array and Updating Field based on array of IDs (ACF + WooCommerce)
- Create custom API endpoint to change custom header image
- Error resetting database index using ALTER TABLE in $wpdb->query
- How to add different menu items on different menus?
- Can I associate a custom post type with another custom post type?
- Creating posts with php-script + csv
- Change WooCommerce Order status from frontend form submitted data
- Show Login Errors In WordPress/Elementor (Code “works”, but breaks site)