From c9afa8e4dcc43294f58eb4723cd8088587d2e147 Mon Sep 17 00:00:00 2001 From: ryan Date: Sat, 24 Dec 2005 05:34:50 +0000 Subject: [PATCH] MAke sure post_parent is valid. git-svn-id: http://svn.automattic.com/wordpress/trunk@3354 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/functions-post.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/wp-includes/functions-post.php b/wp-includes/functions-post.php index 6578d78965..8636a3c197 100644 --- a/wp-includes/functions-post.php +++ b/wp-includes/functions-post.php @@ -272,8 +272,11 @@ function wp_insert_attachment($object, $file = false, $post_parent = 0) { $to_ping = preg_replace('|\s+|', "\n", $to_ping); else $to_ping = ''; - - $post_parent = (int) $post_parent; + + if ( isset($post_parent) ) + $post_parent = (int) $post_parent; + else + $post_parent = 0; if ( isset($menu_order) ) $menu_order = (int) $menu_order;