Ticket #12750: 12750.diff
File 12750.diff, 2.3 KB (added by , 15 years ago) |
---|
-
post.php
1545 1545 * @since 2.5.0 1546 1546 * 1547 1547 * @param string|array $mime_types List of mime types or comma separated string of mime types. 1548 * @param string $table_alias Optional. Specify a table alias, if needed. 1548 1549 * @return string The SQL AND clause for mime searching. 1549 1550 */ 1550 function wp_post_mime_type_where($post_mime_types ) {1551 function wp_post_mime_type_where($post_mime_types, $table_alias = '') { 1551 1552 $where = ''; 1552 1553 $wildcards = array('', '%', '%/%'); 1553 1554 if ( is_string($post_mime_types) ) … … 1575 1576 return ''; 1576 1577 1577 1578 if ( false !== strpos($mime_pattern, '%') ) 1578 $wheres[] = "post_mime_type LIKE '$mime_pattern'";1579 $wheres[] = empty($table_alias) ? "post_mime_type LIKE '$mime_pattern'" : "$table_alias.post_mime_type LIKE '$mime_pattern'"; 1579 1580 else 1580 $wheres[] = "post_mime_type = '$mime_pattern'";1581 $wheres[] = empty($table_alias) ? "post_mime_type = '$mime_pattern'" : "$table_alias.post_mime_type = '$mime_pattern'"; 1581 1582 } 1582 1583 if ( !empty($wheres) ) 1583 1584 $where = ' AND (' . join(' OR ', $wheres) . ') '; -
query.php
2038 2038 $post_ids = get_objects_in_term($term_ids, $taxonomy); 2039 2039 if ( !is_wp_error($post_ids) && !empty($post_ids) ) { 2040 2040 $whichcat .= " AND $wpdb->posts.ID IN (" . implode(', ', $post_ids) . ") "; 2041 $post_type = 'any'; 2042 $q['post_status'] = 'publish'; 2041 if ( empty($post_type) ) 2042 $post_type = 'any'; 2043 if ( empty($q['post_status']) ) 2044 $q['post_status'] = 'publish'; 2043 2045 $post_status_join = true; 2044 2046 } else { 2045 2047 $whichcat = " AND 0 "; … … 2092 2094 2093 2095 // MIME-Type stuff for attachment browsing 2094 2096 2095 if ( isset($q['post_mime_type']) && '' != $q['post_mime_type'] ) 2096 $whichmimetype = wp_post_mime_type_where($q['post_mime_type']); 2097 if ( isset($q['post_mime_type']) && '' != $q['post_mime_type'] ) { 2098 $table_alias = $post_status_join ? $wpdb->posts : ''; 2099 $whichmimetype = wp_post_mime_type_where($q['post_mime_type'], $table_alias); 2100 } 2097 2101 2098 2102 $where .= $search.$whichcat.$whichauthor.$whichmimetype; 2099 2103