WordPress multisite with domain mapping and virtual host on local with fake domain

DocumentRoot for each VirtualHost should point to the directory where you installed WP multisite. There is no actual directory for subsites, they’re all virtual. Using your example: <VirtualHost *:80> DocumentRoot “C:/home/wp-intall-directory” ServerName mysite-1.dev # not required Alias /mysite-1.dev “/home/mysite-1” <Directory “/home/wp-intall-directory”> Options Indexes FollowSymLinks Includes ExecCGI AllowOverride All Order allow,deny Allow from all </Directory> </VirtualHost> … Read more

wp-admin slow in multisite

I ended up enabling WP_DEBUG and found an error – something about fsockopen() not being able to connect to my host (I didn’t write it down and now can’t reproduce it) – and found that it was a DNS issue;- my subdomain (foo.example.com) was resolving to the correct IP (10.0.0.1) but the primary domain wasn’t. … Read more

WordPress Multisite Network installation and dev questions

WordPress Multisite is the way to go WordPress Multisite is highly extensible and will even allow you to map full domain names to the subdomain blogs. I just recently moved 15 client sites to 1 WordPress Multisite install and it went great. There are some great Multisite resources over at wordpress.stackexchange.com Questions tagged with Multisite … Read more

Hard Code Pages into a Theme for a Network (multisite) Installation

Hook into wpmu_new_blog and create your pages: add_action(‘wpmu_new_blog’, ‘create_my_pages’, 10, 2); function create_my_pages($blog_id, $user_id){ switch_to_blog($blog_id); // not really need, new blogs shouldn’t have any content if(get_page_by_title(‘About this Network’)) return; // create each page $page_id = wp_insert_post(array( ‘post_title’ => ‘About this Network’, ‘post_name’ => ‘about-this-network’, ‘post_content’ => ‘Co za asy…’, ‘post_status’ => ‘publish’, ‘post_author’ => $user_id, … Read more

Create unique robots.txt for every site on multisite-installation

Straight from the source, (line 1845 wp-includes/functions.php, 3.3.1): function do_robots() { header( ‘Content-Type: text/plain; charset=utf-8’ ); do_action( ‘do_robotstxt’ ); $output = “User-agent: *\n”; $public = get_option( ‘blog_public’ ); if ( ‘0’ == $public ) { $output .= “Disallow: /\n”; } else { $site_url = parse_url( site_url() ); $path = ( !empty( $site_url[‘path’] ) ) ? … Read more

latest 5 posts using switch_to_blog loop

No, it’s retrieving the posts just fine, but you’re not storing them anywhere. Here’s your code again, with line-by-line documentation: // Set up global variables. Great global $wpdb, $blog_id, $post; // Get a list of blogs in your multisite network $blog_ids = $wpdb->get_col( “SELECT blog_id FROM $wpdb->blogs” ); // Iterate through your list of blogs … Read more

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