mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-08-11 20:30:23 +00:00
Embeds: Allow embedding static front pages and pages having a child page with an embed slug.
This makes `embed` a special slug that can't be used for new pages/posts. When `https://example.com/foo/embed/` is an existing page, embeds fall back to `https://example.com/foo/?embed=true`. Adds unit tests. Fixes #34971. git-svn-id: https://develop.svn.wordpress.org/trunk@36307 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -303,6 +303,26 @@ class Tests_Rewrite extends WP_UnitTestCase {
|
||||
$this->set_permalink_structure();
|
||||
}
|
||||
|
||||
/**
|
||||
* @ticket 34971
|
||||
*/
|
||||
function test_url_to_postid_static_front_page() {
|
||||
$post_id = self::factory()->post->create( array( 'post_type' => 'page' ) );
|
||||
|
||||
$this->assertSame( 0, url_to_postid( home_url() ) );
|
||||
|
||||
update_option( 'show_on_front', 'page' );
|
||||
update_option( 'page_on_front', $post_id );
|
||||
|
||||
$this->assertSame( $post_id, url_to_postid( set_url_scheme( home_url(), 'http' ) ) );
|
||||
$this->assertSame( $post_id, url_to_postid( set_url_scheme( home_url(), 'https' ) ) );
|
||||
$this->assertSame( $post_id, url_to_postid( str_replace( array( 'http://', 'https://' ), 'http://www.', home_url() ) ) );
|
||||
$this->assertSame( $post_id, url_to_postid( home_url() . '#random' ) );
|
||||
$this->assertSame( $post_id, url_to_postid( home_url() . '?random' ) );
|
||||
|
||||
update_option( 'show_on_front', 'posts' );
|
||||
}
|
||||
|
||||
/**
|
||||
* @ticket 21970
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user