[wp-trac] [WordPress Trac] #22816: Multisite WP_Query

WordPress Trac noreply at wordpress.org
Sat Jan 18 18:34:41 UTC 2014


#22816: Multisite WP_Query
--------------------------------------+-----------------------
 Reporter:  ciapci                    |       Owner:
     Type:  feature request           |      Status:  reopened
 Priority:  normal                    |   Milestone:
Component:  Multisite                 |     Version:
 Severity:  major                     |  Resolution:
 Keywords:  dev-feedback needs-patch  |
--------------------------------------+-----------------------
Changes (by kokareff):

 * keywords:   => dev-feedback needs-patch
 * status:  closed => reopened
 * resolution:  maybelater =>


Comment:

 This question is still actual.

 Still there is no way to simply do that:


 {{{
 $the_query = new WP_Query ( array(
                 'multisite' => true,
                 'cache_results' => false,
                 'post_type' => 'post',
                 'post_status' => 'publish',
                 'posts_per_page' => 10,
                 'meta_query' => array(
                     array(
                         'key' => 'general-post',
                         'value' => ""
                     )
                 )
             ) );
 }}}

 Even this:
 [https://github.com/ericandrewlewis/WP_Query_Multisite#readme](ericandrewlewis
 / WP_Query_Multisite) or this
 [https://github.com/miguelpeixe/WP_Query_Multisite](miguelpeixe /
 WP_Query_Multisite) doesn't work properly.

 Also it generating SQL like that:

 {{{
 SELECT SQL_CALC_FOUND_ROWS tables.*
 FROM
   (SELECT wp_posts.*,
           '1' AS site_ID
    FROM wp_posts
    INNER JOIN wp_postmeta ON (wp_posts.ID = wp_postmeta.post_id)
    WHERE 1=1
      AND wp_posts.post_type = 'post'
      AND (wp_posts.post_status = 'publish')
      AND ((wp_postmeta.meta_key = 'general-post'
            AND CAST(wp_postmeta.meta_value AS CHAR) = ''))
    GROUP BY wp_posts.ID
    UNION SELECT wp_6_posts.*,
                 '6' AS site_ID
    FROM wp_6_posts
    INNER JOIN wp_6_postmeta ON (wp_6_posts.ID = wp_6_postmeta.post_id)
    WHERE 1=1
      AND wp_6_posts.post_type = 'post'
      AND (wp_6_posts.post_status = 'publish')
      AND ((wp_6_postmeta.meta_key = 'general-post'
            AND CAST(wp_6_postmeta.meta_value AS CHAR) = ''))
    GROUP BY wp_6_posts.ID
    UNION SELECT wp_7_posts.*,
                 '7' AS site_ID
    FROM wp_7_posts
    INNER JOIN wp_7_postmeta ON (wp_7_posts.ID = wp_7_postmeta.post_id)
    WHERE 1=1
      AND wp_7_posts.post_type = 'post'
      AND (wp_7_posts.post_status = 'publish')
      AND ((wp_7_postmeta.meta_key = 'general-post'
            AND CAST(wp_7_postmeta.meta_value AS CHAR) = ''))
    GROUP BY wp_7_posts.ID
    UNION SELECT wp_8_posts.*,
                 '8' AS site_ID
    FROM wp_8_posts
    INNER JOIN wp_8_postmeta ON (wp_8_posts.ID = wp_8_postmeta.post_id)
    WHERE 1=1
      AND wp_8_posts.post_type = 'post'
      AND (wp_8_posts.post_status = 'publish')
      AND ((wp_8_postmeta.meta_key = 'general-post'
            AND CAST(wp_8_postmeta.meta_value AS CHAR) = ''))
    GROUP BY wp_8_posts.ID) tables
 ORDER BY tables.post_date DESC LIMIT 0,
                                      10
 }}}

 (it doesn't work :-( )

 Well, we have redesigned admin, new shitty default theme, even rebranded
 Wordpress.org. But functionality of Multisite mode still weird and
 '04-style.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/22816#comment:7>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list