From 9f23f85ae289aae0d1321db6ae06af6f87a353f5 Mon Sep 17 00:00:00 2001 From: Andrew Nacin Date: Sun, 6 Oct 2013 12:55:38 +0000 Subject: [PATCH] Run _fix_attachment_links() when post_status is future or private in addition to publish. Fixes regression caused by [20308]. props jond3r. fixes #25268. git-svn-id: https://develop.svn.wordpress.org/trunk@25697 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-admin/includes/post.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/wp-admin/includes/post.php b/src/wp-admin/includes/post.php index dfdc52dda1..d01a26b707 100644 --- a/src/wp-admin/includes/post.php +++ b/src/wp-admin/includes/post.php @@ -748,15 +748,15 @@ function update_meta( $meta_id, $meta_key, $meta_value ) { * @since 2.3.0 * @access private * - * @param unknown_type $post_ID - * @return unknown + * @param int|object $post Post ID or post object. + * @return void|int|WP_Error Void if nothing fixed. 0 or WP_Error on update failure. The post ID on update success. */ -function _fix_attachment_links( $post_ID ) { - $post = get_post( $post_ID, ARRAY_A ); +function _fix_attachment_links( $post ) { + $post = get_post( $post, ARRAY_A ); $content = $post['post_content']; - // quick sanity check, don't run if no pretty permalinks or post is not published - if ( !get_option('permalink_structure') || $post['post_status'] != 'publish' ) + // Don't run if no pretty permalinks or post is not published, scheduled, or privately published. + if ( ! get_option( 'permalink_structure' ) || ! in_array( $post['post_status'], array( 'publish', 'future', 'private' ) ) ) return; // Short if there aren't any links or no '?attachment_id=' strings (strpos cannot be zero)