Make WordPress Core

Changeset 50693


Ignore:
Timestamp:
04/09/2021 11:29:58 AM (6 years ago)
Author:
SergeyBiryukov
Message:

Editor: Use a consistent way to retrieve post ID on Edit Post screens.

Props mukesh27, ravipatel, davidbaumwald.
Fixes #52995.

Location:
trunk/src/wp-admin
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/edit-form-advanced.php

    r48991 r50693  
    7979$action  = isset( $action ) ? $action : '';
    8080
    81 if ( (int) get_option( 'page_for_posts' ) === $post_ID && empty( $post->post_content ) ) {
     81if ( (int) get_option( 'page_for_posts' ) === $post->ID && empty( $post->post_content ) ) {
    8282        add_action( 'edit_form_after_title', '_wp_posts_page_notice' );
    8383        remove_post_type_support( $post_type, 'editor' );
    … …  
    9595if ( $thumbnail_support ) {
    9696        add_thickbox();
    97         wp_enqueue_media( array( 'post' => $post_ID ) );
     97        wp_enqueue_media( array( 'post' => $post->ID ) );
    9898}
    9999
    … …  
    104104 * @todo Document the $messages array(s).
    105105 */
    106 $permalink = get_permalink( $post_ID );
     106$permalink = get_permalink( $post->ID );
    107107if ( ! $permalink ) {
    108108        $permalink = '';
    … …  
    238238        $form_extra .= "<input type='hidden' id='auto_draft' name='auto_draft' value='1' />";
    239239} else {
    240         $autosave = wp_get_post_autosave( $post_ID );
     240        $autosave = wp_get_post_autosave( $post->ID );
    241241}
    242242
    243243$form_action  = 'editpost';
    244 $nonce_action = 'update-post_' . $post_ID;
    245 $form_extra  .= "<input type='hidden' id='post_ID' name='post_ID' value='" . esc_attr( $post_ID ) . "' />";
     244$nonce_action = 'update-post_' . $post->ID;
     245$form_extra  .= "<input type='hidden' id='post_ID' name='post_ID' value='" . esc_attr( $post->ID ) . "' />";
    246246
    247247// Detect if there exists an autosave newer than the post and if that autosave is different than the post.
    … …  
    622622        if ( 'auto-draft' !== $post->post_status ) {
    623623                echo '<span id="last-edit">';
    624                 $last_user = get_userdata( get_post_meta( $post_ID, '_edit_last', true ) );
     624                $last_user = get_userdata( get_post_meta( $post->ID, '_edit_last', true ) );
    625625                if ( $last_user ) {
    626626                        /* translators: 1: Name of most recent post author, 2: Post edited date, 3: Post edited time. */
  • trunk/src/wp-admin/edit-form-blocks.php

    r50647 r50693  
    347347);
    348348
    349 $autosave = wp_get_post_autosave( $post_ID );
     349$autosave = wp_get_post_autosave( $post->ID );
    350350if ( $autosave ) {
    351351        if ( mysql2date( 'U', $autosave->post_modified_gmt, false ) > mysql2date( 'U', $post->post_modified_gmt, false ) ) {
Note: See TracChangeset for help on using the changeset viewer.