Make WordPress Core


Ignore:
Timestamp:
01/15/2016 07:55:19 AM (9 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/class-wp-rewrite.php

    r36255 r36307  
    10231023            $feedquery2 = $feedindex . '?' . $query . '&feed=' . $this->preg_index($num_toks + 1);
    10241024
     1025            // Create query and regex for embeds.
     1026            $embedmatch = $match . $embedregex;
     1027            $embedquery = $embedindex . '?' . $query . '&embed=true';
     1028
    10251029            // If asked to, turn the feed queries into comment feed ones.
    10261030            if ( $forcomments ) {
     
    10341038            // ...adding on /feed/ regexes => queries
    10351039            if ( $feed ) {
    1036                 $rewrite = array( $feedmatch => $feedquery, $feedmatch2 => $feedquery2 );
     1040                $rewrite = array( $feedmatch => $feedquery, $feedmatch2 => $feedquery2, $embedmatch => $embedquery );
    10371041            }
    10381042
Note: See TracChangeset for help on using the changeset viewer.