Deleting sites and users automatically in multisite

Note — as Kaiser rightly points out in his comment, Multisite shares users between sites. If you remove one, you remove her from all the sites in your network. If that’s not your intent, then look into remove_user_from_blog(). Instead of wp_delete_user(), use wpmu_delete_user(). Looking at the source code, wpmu_delete_user() first checks if the user in … Read more

Copy posts from one blog to another in multisite environment

To copy a post from one blog to another you can do something like this: function copy_post_to_blog($post_id, $target_blog_id) { $post = get_post($post_id, ARRAY_A); // get the original post $post[‘ID’] = ”; // empty id field, to tell wordpress that this will be a new post switch_to_blog($target_blog_id); // switch to target blog $inserted_post_id = wp_insert_post($post); // … Read more

WPMU Hook for archive or deactivate blog?

According to wpseek.com, there exist hooks for unarchive_blog, archive_blog, and deactivate_blog. You can examine them in the source on WordPress’s Trac site: archive_blog unarchive_blog deactivate_blog All of them use the $blog_id parameter. Try changing your function to reflect that: add_action( ‘archive_blog’, ‘wp_clear_cache_custom’ ); function wp_clear_cache_custom( $blog_id ) { wp_cache_clear_cache( $blog_id ); }

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