Make WordPress Core

Changeset 60414


Ignore:
Timestamp:
07/05/2025 02:27:23 PM (14 months ago)
Author:
SergeyBiryukov
Message:

Coding Standards: Remove redundant conditional in WP_Customize_Manager.

This check would always be true, as ::handle_changeset_trash_request() returns early a few lines above if $changeset_post_id is false.

Follow-up to [41667], [48211].

Props justlevine.
See #63268.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/class-wp-customize-manager.php

    r59790 r60414  
    31663166                }
    31673167
    3168                 if ( $changeset_post_id ) {
    3169                         if ( ! current_user_can( get_post_type_object( 'customize_changeset' )->cap->delete_post, $changeset_post_id ) ) {
    3170                                 wp_send_json_error(
    3171                                         array(
    3172                                                 'code'    => 'changeset_trash_unauthorized',
    3173                                                 'message' => __( 'Unable to trash changes.' ),
    3174                                         )
    3175                                 );
    3176                         }
    3177 
    3178                         $lock_user = (int) wp_check_post_lock( $changeset_post_id );
    3179 
    3180                         if ( $lock_user && get_current_user_id() !== $lock_user ) {
    3181                                 wp_send_json_error(
    3182                                         array(
    3183                                                 'code'     => 'changeset_locked',
    3184                                                 'message'  => __( 'Changeset is being edited by other user.' ),
    3185                                                 'lockUser' => $this->get_lock_user_data( $lock_user ),
    3186                                         )
    3187                                 );
    3188                         }
     3168                if ( ! current_user_can( get_post_type_object( 'customize_changeset' )->cap->delete_post, $changeset_post_id ) ) {
     3169                        wp_send_json_error(
     3170                                array(
     3171                                        'code'    => 'changeset_trash_unauthorized',
     3172                                        'message' => __( 'Unable to trash changes.' ),
     3173                                )
     3174                        );
     3175                }
     3176
     3177                $lock_user = (int) wp_check_post_lock( $changeset_post_id );
     3178
     3179                if ( $lock_user && get_current_user_id() !== $lock_user ) {
     3180                        wp_send_json_error(
     3181                                array(
     3182                                        'code'     => 'changeset_locked',
     3183                                        'message'  => __( 'Changeset is being edited by other user.' ),
     3184                                        'lockUser' => $this->get_lock_user_data( $lock_user ),
     3185                                )
     3186                        );
    31893187                }
    31903188
Note: See TracChangeset for help on using the changeset viewer.