Using $wpdb Class to Pull Recent Comments Across a Network

Why not use get_comments(), instead of trying to roll your own with $wpdb? function display_sitewide_comments() { $sites = wp_get_sites(); $network_comments = array(); $max = 20; foreach( $sites as $site ) { switch_to_blog( $site->blog_id ); $args = array( ‘number’ => $max, ‘status’ => ‘approved’, ); $network_comments[$site->blog_id] = get_comments( $args ); restore_current_blog(); } // inspect the comments … Read more

Possible to create a multisite network where the main site is non-WP?

I haven’t tested it, but it should be possible with these steps: Use example.net (not .com) as main installation for the multisite (or areallybigteam.com). Install WordPress with subdomains. Create the sites. Edit the URLs of all sites as you need: blog.example.com, team.example.com and areallybigteam.com. Make sure the document root for all these (sub)domains matches your … Read more

How to share posts in WordPress Multisite?

You could use the function switch_to_blog Example: switch_to_blog( $site_id ); $post = get_post( $post_id ); restore_current_blog(); It should do exactly what you need. After switching you can use a custom query to get the relevant information

Creating multisite in wordpress using php

There is a PHP function to create sites: wpmu_create_blog(). The simplest example is: <?php $domain = “something.example.com”; $path = “https://wordpress.stackexchange.com/”; $title = “Look at my awesome site”; wpmu_create_blog($domain, $path, $title); The catch here is you need to have WordPress loaded too in your PHP. If you are doing this as part of a plugin, then … Read more

Is Partial SSL Possible? ( multisite )

Yes – entirely possible to use SSL on only 1 site in a WP network. In the past, we have done this using .htaccess to force HTTPS for all URLs of a particular site, leaving all others HTTP. This was done using carefully written Apache URL rewrites. The SSL used was a wildcard cert although … Read more

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