In get_sample_permalink(), override 'future' status before generating permalink.
In [31114], `get_permalink()` was modified to prevent pretty permalinks from being generated for posts with the 'future' post status. This inadvertently broke the pretty permalink preview for scheduled posts. The fix is to include the 'future' status in the list of statuses that `get_sample_permalink()` fakes as 'publish' before it fetches a permalink. Props DrewAPicture. Fixes #30910. Built from https://develop.svn.wordpress.org/trunk@31323 git-svn-id: http://core.svn.wordpress.org/trunk@31304 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
@@ -1152,7 +1152,7 @@ function get_sample_permalink($id, $title = null, $name = null) {
|
||||
$original_name = $post->post_name;
|
||||
|
||||
// Hack: get_permalink() would return ugly permalink for drafts, so we will fake that our post is published.
|
||||
if ( in_array( $post->post_status, array( 'draft', 'pending' ) ) ) {
|
||||
if ( in_array( $post->post_status, array( 'draft', 'pending', 'future' ) ) ) {
|
||||
$post->post_status = 'publish';
|
||||
$post->post_name = sanitize_title($post->post_name ? $post->post_name : $post->post_title, $post->ID);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user