How to Display Network Post Count?

Made a couple of tweaks to brasofilo’s example as we were getting hit with memory execution issues; one of which may be related to a possible switch_to_blog memory leak that has been impacting sites doing a lot of switch_to_blog calls (we would typically run around ~1000 or so when loading this dashboard widget.) Even with … Read more

Network not displaying all sites and users

When WordPress builds such a list, it runs a check against the function wp_is_large_network(). It sets a limit of 10000 for users and sites, and when you hit that limit, expensive database operations aren’t executed anymore. There are two filters with the same name, so you can change the limit. Example: add_filter( ‘wp_is_large_network’, function( $state, … Read more

Listing of all uploaded files in network sites

You have to run through each blog and fetch the recent attachments with: $args = array ( ‘post_type’ => ‘attachment’, ‘numberposts’ => 30 ); $attachments = get_posts( $args ); Dashboard widgets are registered on wp_network_dashboard_setup in multi-site and wp_dashboard_setup in single-site. Make sure to add the following line to the plugin header to get the … Read more

Customizing wp-activate.php

You are right, this is very hacky. What I ending up doing was creating two new page templates Register and Activate and creating two new WordPress pages using those templates and then using a filter in my functions.php file to modify the behaviour one wpmu_signup_user_notification. Users will register on this new Register page and they … Read more

What’s the Best Way to Structure a Multi-Content Blog?

Your sites look nothing alike. Open those three links – and there is not a single element that binds all three sites together. Network of sites can benefit from consistent looks. You could use global “about” page that covers all of your activity and not just bits in context of specific site. Consider building landing … Read more

Can I set some default pages to be created on every creation of a new blog

I recommend creating a function in your functions.php file that ties to the action hook activate_blog. Use the WordPress functions get_pages() to see if your default pages exist. If they do not, create them with wp_insert_post. add_action(‘activate_blog’,’my_default_pages’); function my_default_pages(){ $default_pages = array(‘About’,’Home’,’My Store’,’My Address’); $existing_pages = get_pages(); foreach($existing_pages as $page){ $temp[] = $page->post_title; } $pages_to_create … Read more

Basic Multisite Question – Managing Content Centrally

I’ve successfully used the ThreeWP Broadcast plugin to do this on a WPMU installation. The basic concept is that you have one ‘broadcasting’ site from which you can broadcast content to other sites. The content can be posts, pages, custom post types, custom taxonomies, post meta or attachments. If content is updated on the ‘broadcasting’ … Read more

get_user_meta() to Return User Meta Only for Current Blog in Multi Site

WordPress distinguishes usermeta keys between sites by using the database prefix for each site. For example, instead of using the favorite_posts key, you’d use the meta key wp_23_favorite_posts. To get the prefix, you can use $wpdb->get_blog_prefix(). But wait, there’s actually a whole API dedicated to this. Rather than using *_user_meta(), use *_user_option(). These are internally … Read more

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