WordPress.org

Make WordPress Core


Ignore:
Timestamp:
01/15/2016 07:55:19 AM (4 years ago)
Author:
swissspidy
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/query.php

    r36278 r36307  
    14571457            , 'fields'
    14581458            , 'menu_order'
     1459            , 'embed'
    14591460        );
    14601461
     
    17571758            $this->is_feed = true;
    17581759
     1760        if ( '' != $qv['embed'] ) {
     1761            $this->is_embed = true;
     1762        }
     1763
    17591764        if ( '' != $qv['tb'] )
    17601765            $this->is_trackback = true;
     
    17891794            if ( isset($_query['pagename']) && '' == $_query['pagename'] )
    17901795                unset($_query['pagename']);
     1796
     1797            unset( $_query['embed'] );
     1798
    17911799            if ( empty($_query) || !array_diff( array_keys($_query), array('preview', 'page', 'paged', 'cpage') ) ) {
    17921800                $this->is_page = true;
     
    18601868            $this->set_404();
    18611869
    1862         $this->is_embed = isset( $qv['embed'] ) && ( $this->is_singular || $this->is_404 );
     1870        $this->is_embed = $this->is_embed && ( $this->is_singular || $this->is_404 );
    18631871
    18641872        $this->query_vars_hash = md5( serialize( $this->query_vars ) );
Note: See TracChangeset for help on using the changeset viewer.