How to get the count

You should use a total_users property: $query = new WP_User_Query( $args ); $query->total_users; or get_total method: $query = new WP_User_Query( $args ); $query-> get_total(); Docs are your friend: https://codex.wordpress.org/Class_Reference/WP_User_Query

Delete Users without a First and Last Name

Replace the prefix in wp_users and wp_usermeta table names for the one you use. Make backup of data from both tables before you start to delete users. DELETE u FROM wp_users u LEFT JOIN wp_usermeta um1 ON u.id = um1.user_id AND um1.meta_key = ‘first_name’ LEFT JOIN wp_usermeta um2 ON u.id = um2.user_id AND um2.meta_key = … Read more

create new users in db starting at what ID?

You don’t give them IDs. The user ID column in the database is an ‘auto increment’ column, meaning that the value is automatically created whenever a row is added. So just add your users without an ID and the database will create one for you.

How to prevent a specific users’s profile photo (gravatar) from showing on the frontend to other users?

Use this hook function to replace user’s avatar (which is passed in as HTML <img …> tag) if user’s ID or email matches your condition. You can use any other default image, or get individual replacement image for each user. function my_get_avatar($avatar, $id_or_email, $size, $default, $alt) { if ($id_or_email == “[email protected]”) { $img = “http://path.to/default/avatar.jpg”; … Read more

is_user_logged_in() throwing undefined function error

It’s failing because WordPress isn’t loaded. Instead of making AJAX requests directly to PHP files in your theme, make them to a REST API endpoint. For example: add_action( ‘rest_api_init’, function () { register_rest_route( ‘petebolduc/v1’, ‘/test/’, array( ‘callback’ => ‘petebolduc_ajax’ ) ); } ); function petebolduc( $parameters ) { $foo = $parameters[‘foo’]; return “foo is ” … Read more

No user found when using REST API

This is happening because you are not using nonces. Because you have not provided a nonce with the request, WordPress is treating you as if you are an unauthorized/non-logged in user. This is because wordpress has no way of knowing/validating the users state. To get this working, you will have to generate a nonce like … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)