exclude roles from overview

Yes, the get_users_of_blog() function is deprecated, and the reason your code breaks after using get_users() is the ->user_id part, you should use ->ID instead. $blogusers = get_users(); if ($blogusers) { foreach ($blogusers as $bloguser) { $args = array( ‘author’ => $bloguser->ID, ‘showposts’ => 1, ); $my_query = new WP_Query($args); if( $my_query->have_posts() ) { while ($my_query->have_posts()) … Read more

How do I customize the dashboard?

Subscribers will see the WP Events and News widget, but they shouldn’t be seeing the other stuff. Somewhere the theme and/or plugins are adding widgets in a way that’s allowing all user levels to see them. You can either hit up the support teams for the themes and plugins that are adding them, or you … Read more

How to set show admin bar front to true for all users?

You can use update_user_option() function (see codex) Your loop looks fine to me, so probably this would work: // Create the WP_User_Query object $wp_user_query = new WP_User_Query(array(‘role’ => ‘Subscriber’)); // Get the results $users = $wp_user_query->get_results(); // Check for results if (!empty($users)) { // loop trough each author foreach ($users as $user) { // update … Read more

Two people sharing user in WordPress [closed]

I suspect what you actually want, is to have all content showing as being authored by the same person. So, simply create a 3rd user, and set it as the author of your posts. The revision log will keep track of who did what e.g. https://www.siteground.com/kb/change-author-post-wordpress/

Assign role to user on first login, if they are first (after admin)

To set is the connected user belongs to the blog, you need to do that on hook wp_login that means the user is connected : const ROLE_ADMINISTRATOR = “administrator”; const ROLE_CONTRIBUTOR = “contributor”; add_action(“wp_login”, function ($user_login, \WP_User $user) { if ( !is_multisite() || is_user_member_of_blog() ) { return; } $usersAdministrator = get_users([ “role” => ROLE_ADMINISTRATOR, ]); … Read more

How to pass external variables to the wp_new_user_notification_email filter?

I believe the problem is you’re using get_stylesheet_directory_uri() function in an attempt to include a file. This function returns a URL when what you want to do when you need to include a file is provide a path. You could be using instead is get_stylesheet_directory() Here’s what the output would look like: // – https://yourwebsite.com/wp-content/themes/my-theme/ … Read more

REST API GET users

Read the docs: you need to add a Header named X-WP-Nonce to your requests to the API that require authentication, as you can see in the jQuery example. However the catch is getting that nonce in the first place. WordPress inject that token itself in the post editing screens. Type wpApiSettings in the developer console … Read more