dynamicOptions->searchAppearance->postTypes->has( 'attachment' ) ) { return; } $redirect = aioseo()->dynamicOptions->searchAppearance->postTypes->attachment->redirectAttachmentUrls; if ( 'disabled' === $redirect ) { return; } if ( 'attachment' === $redirect ) { $url = wp_get_attachment_url( get_queried_object_id() ); if ( empty( $url ) ) { return; } return wp_safe_redirect( $url, 301, AIOSEO_PLUGIN_SHORT_NAME ); } global $post; if ( ! empty( $post->post_parent ) ) { wp_safe_redirect( urldecode( get_permalink( $post->post_parent ) ), 301 ); } } }