Making WordPress.org

Changeset 12136


Ignore:
Timestamp:
10/19/2022 07:34:26 AM (4 years ago)
Author:
dd32
Message:

Photo Directory: Avoid a PHP notice when making a rest api call that includes rejected photos.

The code in [12108] assumed that all photos ever requested through the API would be public with a valid image attachment, but rejected photos do not have this.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/photo-directory/inc/posts.php

    r12108 r12136  
    4343                $data = $response->get_data();
    4444
    45                 $data['photo-thumbnail-url'] = wp_get_attachment_image_src( get_post_thumbnail_id( $data['id'] ), 'medium' )[0];
     45                $data['photo-thumbnail-url'] = wp_get_attachment_image_src( get_post_thumbnail_id( $data['id'] ), 'medium' )[0] ?? '';
    4646
    4747                $response->set_data( $data );
Note: See TracChangeset for help on using the changeset viewer.