What is meant by Multisite in WordPress?

WordPress Multisite allows you to use one WordPress code installation to run multiple websites. mywebsite1.com mywebsite2.com mywebsite3.com etc All run from the same code, can share the same plugins, can share the same themes (but use different themes), share the same admin login (but different sites can be limited to different editors), keep all data … Read more

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

Deleting a user in multisite

I ended up figuring this out a while ago… completely forgot to post it here. Once I added the include properly it worked: require_once(‘./wp-admin/includes/ms.php’); if ( $user ) { wpmu_delete_user( $user->ID ); } For the sake of future readers here was the final code: function handle_gateway_return() { $GWPass = get_option( $this->gateway . “_gateway_gwpass” ); if … Read more

How do I use different domain for subdomains in WP Multisite?

Let’s establish the baseline: it is possible to have the main site in example-domain-x.com and all subsites subdomains in example-domain-y.com. You just add subdomain1.example-domain-y.com (or subdomain2.example-domain-y.com, subdomain3.example-domain-y.com) like you would be adding a bare or www domain in the domain mapping panel ( URL containing wp-admin/network/settings.php?page=dm_domains_admin ). To achieve the same programmatically, you could hook … Read more

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