Make WordPress Core

Ticket #32322: 32322-2.diff

File 32322-2.diff, 2.4 KB (added by andraganescu, 6 years ago)

tabs and spaces fixed in patch

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

    diff --git a/src/wp-includes/link-template.php b/src/wp-includes/link-template.php
    index 510d9a1..2f4fe42 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' ) ) ) {
     168        /**
     169         * Filters the list of post statuses which should use shortlinks and avoid fancy permalinks.
     170         *
     171         * @since 4.3.0
     172         *
     173         * @param array $statuses The list of statuses
     174         */
     175        $auto_short_link_statuses = apply_filters(
     176                'shortlink_post_statuses',
     177                array(
     178                        'draft',
     179                        'pending',
     180                        'auto-draft',
     181                        'future',
     182                )
     183        );
     184
     185        if ( '' != $permalink && ! in_array( $post->post_status, $auto_short_link_statuses ) ) {
    169186                $unixtime = strtotime( $post->post_date );
    170187
    171188                $category = '';
    function get_post_permalink( $id = 0, $leavename = false, $sample = false ) { 
    272289
    273290        $slug = $post->post_name;
    274291
    275         $draft_or_pending = get_post_status( $post ) && in_array( get_post_status( $post ), array( 'draft', 'pending', 'auto-draft', 'future' ) );
     292        $auto_short_link_statuses = apply_filters(
     293                'shortlink_post_statuses',
     294                array(
     295                        'draft',
     296                        'pending',
     297                        'auto-draft',
     298                        'future',
     299                )
     300        );
     301
     302        $draft_or_pending = get_post_status( $post ) && in_array( get_post_status( $post ), $auto_short_link_statuses );
    276303
    277304        $post_type = get_post_type_object( $post->post_type );
    278305
    function get_post_permalink( $id = 0, $leavename = false, $sample = false ) { 
    305332         *
    306333         * @since 3.0.0
    307334         *
     335         *
    308336         * @param string  $post_link The post's permalink.
    309337         * @param WP_Post $post      The post in question.
    310338         * @param bool    $leavename Whether to keep the post name.
    function _get_page_link( $post = false, $leavename = false, $sample = false ) { 
    368396
    369397        $post = get_post( $post );
    370398
    371         $draft_or_pending = in_array( $post->post_status, array( 'draft', 'pending', 'auto-draft' ) );
     399        $auto_short_link_statuses = apply_filters(
     400                'shortlink_post_statuses',
     401                array(
     402                        'draft',
     403                        'pending',
     404                        'auto-draft',
     405                        'future',
     406                )
     407        );
     408
     409        $draft_or_pending = get_post_status( $post ) && in_array( get_post_status( $post ), $auto_short_link_statuses );
    372410
    373411        $link = $wp_rewrite->get_page_permastruct();
    374412