Make WordPress Core


Ignore:
Timestamp:
01/18/2021 12:53:30 PM (3 years ago)
Author:
SergeyBiryukov
Message:

Media: Use consistent method for instantiating an attachment author object in Media Library.

Previously, attachments without an author could cause a PHP fatal error due to calling the ::exists() method on a false value.

Props antpb, carloscastilloadhoc, hellofromTonya, garrett-eclipse.
Fixes #52030.

File:
1 edited

Legend:

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

    r49936 r49979  
    39303930
    39313931    $author = new WP_User( $attachment->post_author );
     3932
    39323933    if ( $author->exists() ) {
    39333934        $author_name            = $author->display_name ? $author->display_name : $author->nickname;
Note: See TracChangeset for help on using the changeset viewer.