mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-07-04 17:20:07 +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:
@@ -3574,7 +3574,7 @@ function wp_unique_post_slug( $slug, $post_ID, $post_status, $post_type, $post_p
|
||||
* @param bool $bad_slug Whether the slug would be bad as an attachment slug.
|
||||
* @param string $slug The post slug.
|
||||
*/
|
||||
if ( $post_name_check || in_array( $slug, $feeds ) || apply_filters( 'wp_unique_post_slug_is_bad_attachment_slug', false, $slug ) ) {
|
||||
if ( $post_name_check || in_array( $slug, $feeds ) || 'embed' === $slug || apply_filters( 'wp_unique_post_slug_is_bad_attachment_slug', false, $slug ) ) {
|
||||
$suffix = 2;
|
||||
do {
|
||||
$alt_post_name = _truncate_post_slug( $slug, 200 - ( strlen( $suffix ) + 1 ) ) . "-$suffix";
|
||||
@@ -3604,7 +3604,7 @@ function wp_unique_post_slug( $slug, $post_ID, $post_status, $post_type, $post_p
|
||||
* @param string $post_type Post type.
|
||||
* @param int $post_parent Post parent ID.
|
||||
*/
|
||||
if ( $post_name_check || in_array( $slug, $feeds ) || preg_match( "@^($wp_rewrite->pagination_base)?\d+$@", $slug ) || apply_filters( 'wp_unique_post_slug_is_bad_hierarchical_slug', false, $slug, $post_type, $post_parent ) ) {
|
||||
if ( $post_name_check || in_array( $slug, $feeds ) || 'embed' === $slug || preg_match( "@^($wp_rewrite->pagination_base)?\d+$@", $slug ) || apply_filters( 'wp_unique_post_slug_is_bad_hierarchical_slug', false, $slug, $post_type, $post_parent ) ) {
|
||||
$suffix = 2;
|
||||
do {
|
||||
$alt_post_name = _truncate_post_slug( $slug, 200 - ( strlen( $suffix ) + 1 ) ) . "-$suffix";
|
||||
@@ -3649,7 +3649,7 @@ function wp_unique_post_slug( $slug, $post_ID, $post_status, $post_type, $post_p
|
||||
* @param string $slug The post slug.
|
||||
* @param string $post_type Post type.
|
||||
*/
|
||||
if ( $post_name_check || in_array( $slug, $feeds ) || $conflicts_with_date_archive || apply_filters( 'wp_unique_post_slug_is_bad_flat_slug', false, $slug, $post_type ) ) {
|
||||
if ( $post_name_check || in_array( $slug, $feeds ) || 'embed' === $slug || $conflicts_with_date_archive || apply_filters( 'wp_unique_post_slug_is_bad_flat_slug', false, $slug, $post_type ) ) {
|
||||
$suffix = 2;
|
||||
do {
|
||||
$alt_post_name = _truncate_post_slug( $slug, 200 - ( strlen( $suffix ) + 1 ) ) . "-$suffix";
|
||||
|
||||
Reference in New Issue
Block a user