How can I display posts from the other sites in a WordPress multisite setup?

后端 未结 2 1988
感情败类
感情败类 2021-02-02 17:54

I have a small network of sites setup with WordPress 3.0\'s multisite feature. I would like to create another site which pulls certain posts from the various other sites to disp

2条回答
  •  春和景丽
    2021-02-02 18:26

    This wouldn't be terribly difficult to set up with direct database calls. You can query posts from any site on the install with the $wpdb object. See Displaying Posts Using a Custom Select Query for information on using a custom database query, but keep in mind that instead of selecting from $wpdb->posts you're going to need to access the specific site table you want posts from. On a default Wordpress 3 install, this would be wp_12_posts where 12 is the site id. The id can be found in the wp_blogs table, or by looking at the ID column in the Sites section of the admin menu.

提交回复
热议问题