Inherit plugin settings to new site in Multisite

Nice Question! But I’ll leave for the asker and for the reader the task of finding the plugin options name. This can be used for any plugin/theme that relies in a single/serialized value in the wp_options table. If it’s not a single value, it’s another task… In this example, I’m using WP-Pagenavi option_name. Action hook … Read more

Perform action on WPMU blog deletion

Yes, inside /wp-admin/includes/ms.php there is the action hook delete_blog. This test prevents a blog deletion: add_action( ‘delete_blog’, ‘prevent_blog_delete_wpse_82961’, 10, 2 ); /** * @param int $blog_id Blog ID * @param bool $drop True if blog’s table should be dropped. Default is false. */ function prevent_blog_delete_wpse_82961( $blog_id, $drop ) { wp_die( ‘aborting delete_blog’ ); }

Allowing periods in usernames

There is a plugin for this. It is Network Username Restrictions Override. Please remember to check out the FAQ #2 to know how to allow periods in usernames. Let me quote it here… You’ll have to update the regular expressions in your .htaccess file if you use email addresses or periods in site URLs. The … Read more

Multisite – Protect categories from deletion?

Extending @Roman’s answer. The following was developed and tested in a Multisite environment – local and live WP installs. Looking at the source of wp_delete_term, there are some hooks that are triggered when the function is called. I’m not sure if this is the best way of doing this, but it works. add_action( ‘delete_term_taxonomy’, ‘wpse_70758_del_tax’, … Read more

How to set configuration options for particular sub blogs?

Hi @Raj Sekharan: If I understand your question lets say you have three (3) subdomains on your multisite and you only want to debug the first? http://foo.example.com http://bar.example.com http://baz.example.com If yes then it’s a simply matter of adding the following to your /wp-config.php file: if ($_SERVER[‘HTTP_HOST’]==’foo.example.com’) define(‘WP_DEBUG’, true); else define(‘WP_DEBUG’, false); Or if you are … Read more

How do I query all posts of one type across my multisite installation?

Yes but not in a single query, e.g.: if(is_multisite()){ global $wpdb; $blogs = $wpdb->get_results($wpdb->prepare(“SELECT * FROM $wpdb->blogs WHERE spam = ‘0’ AND deleted = ‘0’ and archived = ‘0’ and public=”1″”)); if(!empty($blogs)){ ?><?php foreach($blogs as $blog){ switch_to_blog($blog->blog_id); $details = get_blog_details($blog->blog_id); $q = new WP_query(); if($q->have_posts()){ while($q->have_posts()){ $q->the_post(); // do things break; } } wp_reset_query(); restore_current_blog(); … Read more

How to add super admin to all sites

Super admins do have access to all sites, but they don’t show up in “My Sites” by default, which I imagine is where you’re looking. They’ll want to go to the network admin (/wp-admin/network/, then go to all sites from there, then find the site they want to edit and click “Dashboard” (which appears on … Read more