Changeset 57310 for trunk/src/wp-includes/canonical.php
- Timestamp:
- 01/19/2024 12:42:48 AM (14 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/canonical.php
r57232 r57310 551 551 552 552 if ( is_attachment() && ! get_option( 'wp_attachment_pages_enabled' ) ) { 553 $attachment_id = get_query_var( 'attachment_id' ); 554 555 if ( current_user_can( 'read_post', $attachment_id ) ) { 556 $redirect_url = wp_get_attachment_url( $attachment_id ); 557 558 $is_attachment_redirect = true; 559 } 553 $attachment_id = get_query_var( 'attachment_id' ); 554 $attachment_post = get_post( $attachment_id ); 555 $attachment_parent_id = $attachment_post ? $attachment_post->post_parent : 0; 556 557 /* 558 * If an attachment is attached to a post, it inherits the parent post's status. Fetch the 559 * parent post to check its status later. 560 */ 561 if ( $attachment_parent_id ) { 562 $redirect_obj = get_post( $attachment_parent_id ); 563 } 564 $redirect_url = wp_get_attachment_url( $attachment_id ); 565 566 $is_attachment_redirect = true; 560 567 } 561 568
Note: See TracChangeset
for help on using the changeset viewer.