From 015349cd6e58d305e50f8d3cd4340f3a1d5fda3e Mon Sep 17 00:00:00 2001 From: John Blackbourn Date: Sun, 20 Sep 2015 16:38:26 +0000 Subject: [PATCH] Revisions are an exception when it comes to the editing UI. The `revision` post type cannot have its `show_ui` argument set to true because this allows access to the post type listing, creation, and editing UI, but `get_edit_post_link()` needs to return a URL for the editing UI for revisions as that's how the revisions UI works. Fixes #33763 Built from https://develop.svn.wordpress.org/trunk@34357 git-svn-id: http://core.svn.wordpress.org/trunk@34321 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/link-template.php | 11 +++++++++-- wp-includes/version.php | 2 +- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/wp-includes/link-template.php b/wp-includes/link-template.php index 49dcdf5309..4cdc9384a9 100644 --- a/wp-includes/link-template.php +++ b/wp-includes/link-template.php @@ -1221,7 +1221,8 @@ function get_preview_post_link( $post = null, $query_args = array(), $preview_li * * @param int $id Optional. Post ID. * @param string $context Optional, defaults to display. How to write the '&', defaults to '&'. - * @return string|void The edit post link for the given post. + * @return string|null The edit post link for the given post. null if the post type is invalid or does + * not allow an editing UI. */ function get_edit_post_link( $id = 0, $context = 'display' ) { if ( ! $post = get_post( $id ) ) @@ -1241,7 +1242,13 @@ function get_edit_post_link( $id = 0, $context = 'display' ) { if ( !current_user_can( 'edit_post', $post->ID ) ) return; - if ( ! in_array( $post->post_type, get_post_types( array( 'show_ui' => true ) ) ) ) { + $allowed = array_merge( array( + 'revision', + ), get_post_types( array( + 'show_ui' => true, + ) ) ); + + if ( ! in_array( $post->post_type, $allowed ) ) { return; } diff --git a/wp-includes/version.php b/wp-includes/version.php index 9b7f60bc7d..69db5d6f9d 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.4-alpha-34356'; +$wp_version = '4.4-alpha-34357'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.