Ticket #25775: date.php.patch
File date.php.patch, 1.2 KB (added by , 11 years ago) |
---|
-
date.php
151 151 } 152 152 153 153 /** 154 * Validates a column name parameter .154 * Validates a column name parameter and prepends the appropriate $wpdb table name. 155 155 * 156 156 * @since 3.7.0 157 157 * @access public 158 158 * 159 159 * @param string $column The user-supplied column name. 160 * @return string A validated column name value .160 * @return string A validated column name value prepended by its $wpdb table name. 161 161 */ 162 162 public function validate_column( $column ) { 163 global $wpdb; 163 164 $valid_columns = array( 164 165 'post_date', 'post_date_gmt', 'post_modified', 165 166 'post_modified_gmt', 'comment_date', 'comment_date_gmt' … … 174 175 */ 175 176 if ( ! in_array( $column, apply_filters( 'date_query_valid_columns', $valid_columns ) ) ) 176 177 $column = 'post_date'; 177 178 179 // Add our table prefix depending on what column we are looking at. 180 if ( 0 === strpos( $column, 'comment' ) ) 181 $column = "{$wpdb->comments}.{$column}"; 182 else if ( 0 === strpos( $column, 'post' ) ) 183 $column = "{$wpdb->posts}.{$column}"; 184 178 185 return $column; 179 186 } 180 187