Can wp-cli display all users and their roles across all sites in a multisite instance?

List all the admins of each site Side note: Dividing these up by site would also be handy. Let’s do that here: We can list the url of each site with: wp site list –field=url We can list all administrators of a given site with: wp user list –role=administrator –url=https://example.tld/site1 These commands can be combined … Read more

Multi-site: Change the URL of main site to HTTPS

I would suggest editing the wp-config.php file, and adding: define(‘WP_HOME’,’https://example.com’); define(‘WP_SITEURL’,’https://example.com’); However for multisite here it says you should edit DOMAIN_CURRENT_SITE and PATH_CURRENT_SITE, if there is such thing defined in a multisite wp-config. First suggestion is based on this article.

How to get a user role of a specific blog in multisite?

You can use either WP_User: $wp_user_obj = new WP_User( // $user_id get_current_user_id(), // $name | login, ignored if $user_id is set ”, // $blog_id get_current_blog_id() ); Or get_users(): $get_users_obj = get_users( array( ‘blog_id’ => get_current_blog_id(), ‘search’ => get_current_user_id() ) ); As they are both blog_id perceptive, if you provide it. The former will return a … Read more

How To Remove Dashboard Menu Items for Multisite Users?

1) Install & network activate User Role Editor plugin from http://example.com/wp-admin/network/plugins.php 2) Then go to Settings > User Role Editor menu on network and make sure you have the settings as shown in following screenshot. 3) Go to “User Role Editor” settings page on your main site http://example.com/wp-admin/users.php?page=users-user-role-editor.php and select the “Administrator” role. Then remove … Read more

Add Rewrite Rule to point to a file on the server

(Revised answer) Don’t call flush_rewrite_rules() on init. Instead, if you want to do it programmatically, call the function from your plugin or theme activation function. If you’re not doing it programmatically, you could simply visit the Permalink Settings page (Settings → Permalinks on the WordPress back-end). WordPress does support adding a rewrite rule that doesn’t … Read more

Sharing Header Components Across Multisite

Outsource this function into a Plugin If you want a specific function available across multiple themes, it is best to have it in a Plugin, and activate it networkwide. Find the function Locate the function in the theme where it is available. You now have two possibilities: Delete the function from the current theme Make … Read more

current_user_can(‘Administrator’) does not return true in multisite if user is Administrator but NOT Super Admin

I would agree that current_user_can(‘Administrator’) should return true for the user. However, current_user_can is primarily intended to check for capabilities, which is generally a more robust check to be making. I’d suggest something like this (untested): if ( current_user_can( ‘activate_plugins’ ) && ! current_user_can( ‘update_core’ ) ) { //… } So this is checking if … Read more

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