Ticket #10758: 10758-wp-includes-post.patch
File 10758-wp-includes-post.patch, 2.1 KB (added by , 14 years ago) |
---|
-
wp-includes/post.php
1798 1798 /** 1799 1799 * Given the desired slug and some post details computes a unique slug for the post. 1800 1800 * 1801 * @global wpdb $wpdb 1802 * @global WP_Rewrite $wp_rewrite 1801 1803 * @param string $slug the desired slug (post_name) 1802 1804 * @param integer $post_ID 1803 1805 * @param string $post_status no uniqueness checks are made if the post is still draft or pending … … 1808 1810 function wp_unique_post_slug($slug, $post_ID, $post_status, $post_type, $post_parent) { 1809 1811 if ( in_array( $post_status, array( 'draft', 'pending' ) ) ) 1810 1812 return $slug; 1811 1813 /* 1814 * @var $wp_rewrite WP_Rewrite 1815 * @var $wpdb wpdb 1816 */ 1812 1817 global $wpdb, $wp_rewrite; 1813 1818 $hierarchical_post_types = apply_filters('hierarchical_post_types', array('page')); 1814 1819 if ( 'attachment' == $post_type ) { … … 1831 1836 $check_sql = "SELECT post_name FROM $wpdb->posts WHERE post_name = %s AND post_type IN ( '" . implode("', '", $wpdb->escape($hierarchical_post_types)) . "' ) AND ID != %d AND post_parent = %d LIMIT 1"; 1832 1837 $post_name_check = $wpdb->get_var($wpdb->prepare($check_sql, $slug, $post_ID, $post_parent)); 1833 1838 1834 if ( $post_name_check || in_array($slug, $wp_rewrite->feeds) ) { 1839 $feeds = $wp_rewrite->feeds; 1840 if ( is_null($feeds) ) 1841 $feeds = array(); 1842 1843 if ( $post_name_check || in_array($slug, $feeds) ) { 1835 1844 $suffix = 2; 1836 1845 do { 1837 1846 $alt_post_name = substr($slug, 0, 200-(strlen($suffix)+1)). "-$suffix"; … … 1845 1854 $check_sql = "SELECT post_name FROM $wpdb->posts WHERE post_name = %s AND post_type = %s AND ID != %d LIMIT 1"; 1846 1855 $post_name_check = $wpdb->get_var($wpdb->prepare($check_sql, $slug, $post_type, $post_ID)); 1847 1856 1848 if ( $post_name_check || in_array($slug, $wp_rewrite->feeds) ) { 1857 $feeds = $wp_rewrite->feeds; 1858 if ( is_null($feeds) ) 1859 $feeds = array(); 1860 1861 if ( $post_name_check || in_array($slug, $feeds) ) { 1849 1862 $suffix = 2; 1850 1863 do { 1851 1864 $alt_post_name = substr($slug, 0, 200-(strlen($suffix)+1)). "-$suffix";