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
This commit is contained in:
Andrew Nacin 2013-10-06 12:55:38 +00:00
parent 48f68c8c6b
commit 9f23f85ae2

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)