mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-04-04 20:54:29 +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:
@@ -345,7 +345,7 @@ function wp_oembed_register_route() {
|
||||
function wp_oembed_add_discovery_links() {
|
||||
$output = '';
|
||||
|
||||
if ( is_singular() && ! is_front_page() ) {
|
||||
if ( is_singular() ) {
|
||||
$output .= '<link rel="alternate" type="application/json+oembed" href="' . esc_url( get_oembed_endpoint_url( get_permalink() ) ) . '" />' . "\n";
|
||||
|
||||
if ( class_exists( 'SimpleXMLElement' ) ) {
|
||||
@@ -387,9 +387,10 @@ function get_post_embed_url( $post = null ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( get_option( 'permalink_structure' ) ) {
|
||||
$embed_url = trailingslashit( get_permalink( $post ) ) . user_trailingslashit( 'embed' );
|
||||
} else {
|
||||
$embed_url = trailingslashit( get_permalink( $post ) ) . user_trailingslashit( 'embed' );
|
||||
$path_conflict = get_page_by_path( str_replace( home_url(), '', $embed_url ), OBJECT, get_post_types( array( 'public' => true ) ) );
|
||||
|
||||
if ( ! get_option( 'permalink_structure' ) || $path_conflict ) {
|
||||
$embed_url = add_query_arg( array( 'embed' => 'true' ), get_permalink( $post ) );
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user