Make WordPress Core

Ticket #30910: link-template.php.patch

File link-template.php.patch, 2.1 KB (added by CalEvans, 10 years ago)

link-template.php.patch

  • src/wp-includes/link-template.php

     
    132132                $sample = false;
    133133        }
    134134
    135         if ( empty($post->ID) )
     135        if ( empty($post->ID) ) {
    136136                return false;
     137        }
    137138
    138         if ( $post->post_type == 'page' )
     139        if ( $post->post_type == 'page' ) {
    139140                return get_page_link($post, $leavename, $sample);
    140         elseif ( $post->post_type == 'attachment' )
     141        } elseif ( $post->post_type == 'attachment' ) {
    141142                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) ) ) ) {
    143144                return get_post_permalink($post, $leavename, $sample);
     145        }
    144146
    145147        $permalink = get_option('permalink_structure');
    146148
     
    157159         */
    158160        $permalink = apply_filters( 'pre_post_link', $permalink, $post, $leavename );
    159161
    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')) ) {
    161163                $unixtime = strtotime($post->post_date);
    162164
    163165                $category = '';
     
    253255
    254256        $slug = $post->post_name;
    255257
    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' ) );
    257259
    258260        $post_type = get_post_type_object($post->post_type);
    259261
     
    267269                }
    268270                $post_link = home_url( user_trailingslashit($post_link) );
    269271        } 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 ) ) {
    271273                        $post_link = add_query_arg($post_type->query_var, $slug, '');
    272                 else
     274                } else {
    273275                        $post_link = add_query_arg(array('post_type' => $post->post_type, 'p' => $post->ID), '');
     276                }
    274277                $post_link = home_url($post_link);
    275278        }
    276279