Changeset 6173 for trunk/wp-includes/canonical.php
- Timestamp:
- 09/27/2007 07:34:15 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/canonical.php
r6143 r6173 181 181 return false; 182 182 183 $where = "post_name LIKE '" . $wpdb->escape(get_query_var('name')) . "%'";183 $where = $wpdb->prepare("post_name LIKE %s", get_query_var('name') . '%'); 184 184 185 185 // if any of year, monthnum, or day are set, use them to refine the query 186 186 if ( get_query_var('year') ) 187 $where .= " AND YEAR(post_date) = '" . $wpdb->escape(get_query_var('year')) . "'";187 $where .= $wpdb->prepare(" AND YEAR(post_date) = %d", get_query_var('year')); 188 188 if ( get_query_var('monthnum') ) 189 $where .= " AND MONTH(post_date) = '" . $wpdb->escape(get_query_var('monthnum')) . "'";189 $where .= $wpdb->prepare(" AND MONTH(post_date) = %d", get_query_var('monthnum')); 190 190 if ( get_query_var('day') ) 191 $where .= " AND DAYOFMONTH(post_date) = '" . $wpdb->escape(get_query_var('day')) . "'";191 $where .= $wpdb->prepare(" AND DAYOFMONTH(post_date) = %d", get_query_var('day')); 192 192 193 193 $post_id = $wpdb->get_var("SELECT ID FROM $wpdb->posts WHERE $where AND post_status = 'publish'");
Note: See TracChangeset
for help on using the changeset viewer.