WordPress.org

Make WordPress Core

Changeset 34357


Ignore:
Timestamp:
09/20/2015 04:37:41 PM (5 years ago)
Author:
johnbillion
Message:

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

File:
1 edited

Legend:

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

    r34336 r34357  
    12221222 * @param int    $id      Optional. Post ID.
    12231223 * @param string $context Optional, defaults to display. How to write the '&', defaults to '&'.
    1224  * @return string|void The edit post link for the given post.
     1224 * @return string|null The edit post link for the given post. null if the post type is invalid or does
     1225 *                     not allow an editing UI.
    12251226 */
    12261227function get_edit_post_link( $id = 0, $context = 'display' ) {
     
    12421243        return;
    12431244
    1244     if ( ! in_array( $post->post_type, get_post_types( array( 'show_ui' => true ) ) ) ) {
     1245    $allowed = array_merge( array(
     1246        'revision',
     1247    ), get_post_types( array(
     1248        'show_ui' => true,
     1249    ) ) );
     1250
     1251    if ( ! in_array( $post->post_type, $allowed ) ) {
    12451252        return;
    12461253    }
Note: See TracChangeset for help on using the changeset viewer.