Ticket #30910: link-template.php.patch
File link-template.php.patch, 2.1 KB (added by , 10 years ago) |
---|
-
src/wp-includes/link-template.php
132 132 $sample = false; 133 133 } 134 134 135 if ( empty($post->ID) ) 135 if ( empty($post->ID) ) { 136 136 return false; 137 } 137 138 138 if ( $post->post_type == 'page' ) 139 if ( $post->post_type == 'page' ) { 139 140 return get_page_link($post, $leavename, $sample); 140 elseif ( $post->post_type == 'attachment' )141 } elseif ( $post->post_type == 'attachment' ) { 141 142 return get_attachment_link( $post, $leavename ); 142 elseif ( in_array($post->post_type, get_post_types( array('_builtin' => false) ) ) )143 } elseif ( in_array($post->post_type, get_post_types( array('_builtin' => false) ) ) ) { 143 144 return get_post_permalink($post, $leavename, $sample); 145 } 144 146 145 147 $permalink = get_option('permalink_structure'); 146 148 … … 157 159 */ 158 160 $permalink = apply_filters( 'pre_post_link', $permalink, $post, $leavename ); 159 161 160 if ( '' != $permalink && !in_array($post->post_status, array('draft', 'pending', 'auto-draft')) ) {162 if ( $permalink != '' && !in_array($post->post_status, array('draft', 'pending', 'auto-draft', 'future')) ) { 161 163 $unixtime = strtotime($post->post_date); 162 164 163 165 $category = ''; … … 253 255 254 256 $slug = $post->post_name; 255 257 256 $draft_or_pending = isset($post->post_status) && in_array( $post->post_status, array( 'draft', 'pending', 'auto-draft' ) );258 $draft_or_pending = isset($post->post_status) && in_array( $post->post_status, array( 'draft', 'pending', 'auto-draft', 'future' ) ); 257 259 258 260 $post_type = get_post_type_object($post->post_type); 259 261 … … 267 269 } 268 270 $post_link = home_url( user_trailingslashit($post_link) ); 269 271 } else { 270 if ( $post_type->query_var && ( isset($post->post_status) && !$draft_or_pending ) ) 272 if ( $post_type->query_var && ( isset($post->post_status) && !$draft_or_pending ) ) { 271 273 $post_link = add_query_arg($post_type->query_var, $slug, ''); 272 else274 } else { 273 275 $post_link = add_query_arg(array('post_type' => $post->post_type, 'p' => $post->ID), ''); 276 } 274 277 $post_link = home_url($post_link); 275 278 } 276 279