if you are using VIP add this line before command vip @application-name.environment -- wp COMMAND
Create Users Multisite
Update user List in one website
wp user update my_username --url=other-multisite.com --role=administator
Add user to all multisite
wp user create bob [email protected] --role=administrator --user_pass=Pasword
wp site list --field=url | xargs -I % wp user set-role <user-login> <role> --url=%
So, if a user exists in multisite, then how do you go about adding them to a particular blog then?
wp --url=subsite.example.com user set-role <user-login> <role>
some useful links
Simply download the following http-to-https.php file and run:
wp site list --field=url | xargs -I % wp eval-file http-to-https.php --url=%
http-to-https.php
<?php
/**
* Update a specific site from 'http://' to 'https://'.
*
* Only touches the 'home' and 'siteurl' options.
* Depending on plugins, etc., you may need to update other options too.
*
* Run on WordPress multisite with:
*
* wp site list --field=url | xargs -I % wp eval-file http-to-https.php --url=%
*/
foreach ( array( 'home', 'siteurl' ) as $option ) {
$existing = get_option( $option );
$new = str_replace( 'http://', 'https://', $existing );
if ( update_option( $option, $new ) ) {
WP_CLI::log( "Updated '{$option}' to '{$new}'" );
} else {
WP_CLI::log( "Didn't update '{$option}' to '{$new}'" );
}
}
WP_CLI::success( 'Options updated for ' . home_url() );
Remove the website taxonomy
<?php
function remove_taxonomy(){
global $wpdb;
$taxonomy_name = 'the_taxonomy_to_delete';
Deletes all the terms associated to the taxonomy.
# The inner query collects from the 'term_taxonomy'
# table all the ids of the terms to delete.
$wpdb->query(
"DELETE FROM {$wpdb->terms} AS t
WHERE t.term_id IN (
SELECT tt.term_id FROM {$wpdb->term_taxonomy} AS tt
WHERE tt.taxonomy = '{$taxonomy_name}'
)"
);
# Deletes the information used by WordPress
# to link each post to their terms.
#
# Here too, a nested query is needed,
# and the 'term_taxonomy' table is yet again
# the source of the data passed to the outer query.
# But in this case to be collected by
# the inner query are the ids of
# the Relationships to delete.
$wpdb->query(
"DELETE FROM {$wpdb->term_relationships} AS tr
WHERE tr.term_taxonomy_id IN (
SELECT tt.term_taxonomy_id FROM {$wpdb->term_taxonomy} AS tt
WHERE tt.taxonomy = '{$taxonomy_name}'
)"
);
# Deletes the base information about the taxonomy.
$wpdb->query(
"DELETE FROM {$wpdb->term_taxonomy}
WHERE taxonomy = '{$taxonomy_name}'"
);
}
?>