Run _fix_attachment_links() when post_status is future or private in addition to publish.

Fixes regression caused by [20308].

props jond3r.
fixes #25268.

Built from https://develop.svn.wordpress.org/trunk@25697


git-svn-id: http://core.svn.wordpress.org/trunk@25612 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Andrew Nacin 2013-10-06 12:56:09 +00:00
parent 6113669e22
commit e8e5f48905

View File

@ -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)