mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-04-05 05:04:31 +00:00
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. git-svn-id: https://develop.svn.wordpress.org/trunk@31323 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -178,4 +178,26 @@ class Tests_Admin_includesPost extends WP_UnitTestCase {
|
||||
$this->assertEquals( 'closed', $post->ping_status );
|
||||
}
|
||||
|
||||
}
|
||||
/**
|
||||
* @ticket 30910
|
||||
*/
|
||||
public function test_get_sample_permalink_should_return_pretty_permalink_for_posts_with_post_status_future() {
|
||||
global $wp_rewrite;
|
||||
|
||||
$old_permalink_structure = get_option( 'permalink_structure' );
|
||||
$permalink_structure = '%postname%';
|
||||
$wp_rewrite->set_permalink_structure( "/$permalink_structure/" );
|
||||
flush_rewrite_rules();
|
||||
|
||||
$future_date = date( 'Y-m-d H:i:s', time() + 100 );
|
||||
$p = $this->factory->post->create( array( 'post_status' => 'future', 'post_name' => 'foo', 'post_date' => $future_date ) );
|
||||
|
||||
$found = get_sample_permalink( $p );
|
||||
$expected = trailingslashit( home_url( $permalink_structure ) );
|
||||
|
||||
$this->assertSame( $expected, $found[0] );
|
||||
|
||||
$wp_rewrite->set_permalink_structure( $old_permalink_structure );
|
||||
flush_rewrite_rules();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user