diff --git a/wp-includes/link-template.php b/wp-includes/link-template.php index 9419633632..5698ded47a 100644 --- a/wp-includes/link-template.php +++ b/wp-includes/link-template.php @@ -166,7 +166,6 @@ function get_permalink( $post = 0, $leavename = false ) { $permalink = apply_filters( 'pre_post_link', $permalink, $post, $leavename ); if ( '' != $permalink && ! in_array( $post->post_status, array( 'draft', 'pending', 'auto-draft', 'future' ) ) ) { - $unixtime = strtotime( $post->post_date ); $category = ''; if ( strpos( $permalink, '%category%' ) !== false ) { @@ -212,9 +211,11 @@ function get_permalink( $post = 0, $leavename = false ) { $author = $authordata->user_nicename; } - $date = explode( ' ', gmdate( 'Y m d H i s', $unixtime ) ); - $rewritereplace = - array( + // This is not an API call because the permalink is based on the stored post_date value, + // which should be parsed as local time regardless of the default PHP timezone. + $date = explode( ' ', str_replace( array( '-', ':' ), ' ', $post->post_date ) ); + + $rewritereplace = array( $date[0], $date[1], $date[2], @@ -227,8 +228,10 @@ function get_permalink( $post = 0, $leavename = false ) { $author, $post->post_name, ); - $permalink = home_url( str_replace( $rewritecode, $rewritereplace, $permalink ) ); - $permalink = user_trailingslashit( $permalink, 'single' ); + + $permalink = home_url( str_replace( $rewritecode, $rewritereplace, $permalink ) ); + $permalink = user_trailingslashit( $permalink, 'single' ); + } else { // if they're not using the fancy permalink option $permalink = home_url( '?p=' . $post->ID ); } diff --git a/wp-includes/version.php b/wp-includes/version.php index bd1ab5d963..5080d0f0d9 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -13,7 +13,7 @@ * * @global string $wp_version */ -$wp_version = '5.3.1-alpha-46794'; +$wp_version = '5.3.1-alpha-46796'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.