Changeset 54524 for trunk/src/wp-includes/post.php
- Timestamp:
- 10/17/2022 11:17:38 AM (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/post.php
r54377 r54524 7934 7934 7935 7935 /** 7936 * Filters the SQL clauses of an attachment query to include filenames.7937 *7938 * @since 4.7.07939 * @access private7940 *7941 * @global wpdb $wpdb WordPress database abstraction object.7942 *7943 * @param string[] $clauses An array including WHERE, GROUP BY, JOIN, ORDER BY,7944 * DISTINCT, fields (SELECT), and LIMITS clauses.7945 * @return string[] The modified array of clauses.7946 */7947 function _filter_query_attachment_filenames( $clauses ) {7948 global $wpdb;7949 remove_filter( 'posts_clauses', __FUNCTION__ );7950 7951 // Add a LEFT JOIN of the postmeta table so we don't trample existing JOINs.7952 $clauses['join'] .= " LEFT JOIN {$wpdb->postmeta} AS sq1 ON ( {$wpdb->posts}.ID = sq1.post_id AND sq1.meta_key = '_wp_attached_file' )";7953 7954 $clauses['groupby'] = "{$wpdb->posts}.ID";7955 7956 $clauses['where'] = preg_replace(7957 "/\({$wpdb->posts}.post_content (NOT LIKE|LIKE) (\'[^']+\')\)/",7958 '$0 OR ( sq1.meta_value $1 $2 )',7959 $clauses['where']7960 );7961 7962 return $clauses;7963 }7964 7965 /**7966 7936 * Sets the last changed time for the 'posts' cache group. 7967 7937 *
Note: See TracChangeset
for help on using the changeset viewer.