Sanity check properties in wp_get_single_post(). Props filosofo. fixes #13904 for 3.0.1
git-svn-id: http://svn.automattic.com/wordpress/branches/3.0@15406 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
6bd16888b1
commit
563b901f42
|
@ -2077,6 +2077,12 @@ function wp_get_single_post($postid = 0, $mode = OBJECT) {
|
|||
|
||||
$post = get_post($postid, $mode);
|
||||
|
||||
if (
|
||||
( OBJECT == $mode && empty( $post->ID ) ) ||
|
||||
( OBJECT != $mode && empty( $post['ID'] ) )
|
||||
)
|
||||
return ( OBJECT == $mode ? null : array() );
|
||||
|
||||
// Set categories and tags
|
||||
if ( $mode == OBJECT ) {
|
||||
$post->post_category = array();
|
||||
|
@ -2418,7 +2424,7 @@ function wp_update_post($postarr = array()) {
|
|||
$post_cats = $post['post_category'];
|
||||
|
||||
// Drafts shouldn't be assigned a date unless explicitly done so by the user
|
||||
if ( in_array($post['post_status'], array('draft', 'pending', 'auto-draft')) && empty($postarr['edit_date']) &&
|
||||
if ( isset( $post['post_status'] ) && in_array($post['post_status'], array('draft', 'pending', 'auto-draft')) && empty($postarr['edit_date']) &&
|
||||
('0000-00-00 00:00:00' == $post['post_date_gmt']) )
|
||||
$clear_date = true;
|
||||
else
|
||||
|
|
Loading…
Reference in New Issue