Changing site taglines for whole of network

Hi,

I am wanting to change the tagline for every site and new site on my WP network. I don't want the users to set it like the plugin "set Blog description" provided on this site. I simply want the tagline to be welcome to your new "network name" website, not the usual "just another" is their anything I can change in the core files?

  • Sajid

    Hi @hello234,

    Hope you are doing good today :slight_smile:

    Use this snippet to change site tagline of existing sites. Run this code only once. At first time it will get 200 sites.

    If you have more than 200 sites then feel free to change the limit (keep in mind it will take some time if you have really big network).

    You can also run this code multiple times and keep changing the offset parameter. The value of offset after first time will be multiplication of 200 for second time, 400 for third time and so on.

    function wpmu_change_theme_on_all_subsites(){
    
    	global $switched;
    
    	$args = array ('limit' => 200 , 'offset' => 0 );
    
    	$sites = wp_get_sites( $args );
    
    	if($sites){
    		foreach ($sites as $key => $value) {
    			if( is_main_site($value['blog_id']) ) continue;
    
    				update_blog_option( $value['blog_id'], $option = 'description', $value = 'Replace this text with actual blog tagline', $deprecated )
    
    		}
    	}
    
    }
    add_action('init', 'wpmu_change_theme_on_all_subsites');

    To set the default tagline for new sites use following snippet.

    function set_default_tagline($blog_id){
    
    	update_blog_option( $blog_id, $option = 'description', $value = 'Replace this text with actual blog tagline', $deprecated );
    
    }
    add_action('wpmu_new_blog', 'set_default_tagline' );

    You can keep this snippet in your site to make it work for all future sites.

    Note: Always take backup of your website first before using a PHP snippet.

    Take care and have a nice day :slight_smile:
    Cheers, Sajid

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.