Changeset 15625
- Timestamp:
- 09/17/2010 05:07:11 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/query.php
r15624 r15625 1878 1878 // Category stuff for nice URLs 1879 1879 if ( '' != $q['category_name'] && !$this->is_singular ) { 1880 $q['category_name'] = implode('/', array_map('sanitize_title', explode('/', $q['category_name']))); 1881 $reqcat = get_category_by_path($q['category_name']); 1882 $q['category_name'] = str_replace('%2F', '/', urlencode(urldecode($q['category_name']))); 1883 $cat_paths = '/' . trim($q['category_name'], '/'); 1884 $q['category_name'] = sanitize_title(basename($cat_paths)); 1885 1886 $cat_paths = '/' . trim(urldecode($q['category_name']), '/'); 1887 $q['category_name'] = sanitize_title(basename($cat_paths)); 1888 $cat_paths = explode('/', $cat_paths); 1889 $cat_path = ''; 1890 foreach ( (array) $cat_paths as $pathdir ) 1891 $cat_path .= ( $pathdir != '' ? '/' : '' ) . sanitize_title($pathdir); 1892 1893 //if we don't match the entire hierarchy fallback on just matching the nicename 1894 if ( empty($reqcat) ) 1895 $reqcat = get_category_by_path($q['category_name'], false); 1896 1897 if ( !empty($reqcat) ) 1898 $reqcat = $reqcat->term_id; 1899 else 1900 $reqcat = 0; 1901 1902 $q['cat'] = $reqcat; 1880 $q['category_name'] = str_replace( '%2F', '/', urlencode(urldecode($q['category_name'])) ); 1881 $q['category_name'] = '/' . trim( $q['category_name'], '/' ); 1903 1882 1904 1883 $tax_query[] = array( 1905 1884 'taxonomy' => 'category', 1906 'terms' => array( $q['cat']),1885 'terms' => array( basename( $q['category_name'] ) ), 1907 1886 'operator' => 'IN', 1908 'field' => ' term_id'1887 'field' => 'slug' 1909 1888 ); 1910 1889 }
Note: See TracChangeset
for help on using the changeset viewer.