mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-07-07 18:50:12 +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:
@@ -1456,6 +1456,7 @@ class WP_Query {
|
||||
, 'title'
|
||||
, 'fields'
|
||||
, 'menu_order'
|
||||
, 'embed'
|
||||
);
|
||||
|
||||
foreach ( $keys as $key ) {
|
||||
@@ -1756,6 +1757,10 @@ class WP_Query {
|
||||
if ( '' != $qv['feed'] )
|
||||
$this->is_feed = true;
|
||||
|
||||
if ( '' != $qv['embed'] ) {
|
||||
$this->is_embed = true;
|
||||
}
|
||||
|
||||
if ( '' != $qv['tb'] )
|
||||
$this->is_trackback = true;
|
||||
|
||||
@@ -1788,6 +1793,9 @@ class WP_Query {
|
||||
// pagename can be set and empty depending on matched rewrite rules. Ignore an empty pagename.
|
||||
if ( isset($_query['pagename']) && '' == $_query['pagename'] )
|
||||
unset($_query['pagename']);
|
||||
|
||||
unset( $_query['embed'] );
|
||||
|
||||
if ( empty($_query) || !array_diff( array_keys($_query), array('preview', 'page', 'paged', 'cpage') ) ) {
|
||||
$this->is_page = true;
|
||||
$this->is_home = false;
|
||||
@@ -1859,7 +1867,7 @@ class WP_Query {
|
||||
if ( '404' == $qv['error'] )
|
||||
$this->set_404();
|
||||
|
||||
$this->is_embed = isset( $qv['embed'] ) && ( $this->is_singular || $this->is_404 );
|
||||
$this->is_embed = $this->is_embed && ( $this->is_singular || $this->is_404 );
|
||||
|
||||
$this->query_vars_hash = md5( serialize( $this->query_vars ) );
|
||||
$this->query_vars_changed = false;
|
||||
|
||||
Reference in New Issue
Block a user