WordPress.org

Make WordPress Core

Ticket #49871: 49871-2.diff

File 49871-2.diff, 1.3 KB (added by Jules Colle, 20 months ago)

show permalink instead of guid for scheduled posts, meanwhile ensuring that guids will not automatically redirect to the permalink version as long as the post is scheduled.

  • src/wp-includes/canonical.php

    diff --git a/src/wp-includes/canonical.php b/src/wp-includes/canonical.php
    index 4d373e13bd..ed81d93ff8 100644
    a b function redirect_canonical( $requested_url = null, $do_redirect = true ) { 
    5656                }
    5757        }
    5858
    59         if ( is_trackback() || is_search() || is_admin() || is_preview() || is_robots() || is_favicon() || ( $is_IIS && ! iis7_supports_permalinks() ) ) {
     59        if ( is_trackback() || is_search() || is_admin() || is_preview() || is_robots() || is_favicon() || 'future' == get_post_status( get_query_var( 'p' ) ) || ( $is_IIS && ! iis7_supports_permalinks() ) ) {
    6060                return;
    6161        }
    6262diff --git a/src/wp-includes/link-template.php b/src/wp-includes/link-template.php
  • src/wp-includes/link-template.php

    index 9dbbf4931f..eefc966114 100644
    a b function get_permalink( $post = 0, $leavename = false ) { 
    165165         */
    166166        $permalink = apply_filters( 'pre_post_link', $permalink, $post, $leavename );
    167167
    168         if ( '' != $permalink && ! in_array( $post->post_status, array( 'draft', 'pending', 'auto-draft', 'future' ), true ) ) {
     168        if ( '' != $permalink && ! in_array( $post->post_status, array( 'draft', 'pending', 'auto-draft' ), true ) ) {
    169169
    170170                $category = '';
    171171                if ( strpos( $permalink, '%category%' ) !== false ) {