From 9dd574bd996daa490a54dca03afd98fef869a0a3 Mon Sep 17 00:00:00 2001 From: Rachel Baker Date: Thu, 10 Dec 2015 15:17:29 +0000 Subject: [PATCH] =?UTF-8?q?Comments:=20Comments=20don=E2=80=99t=20need=20n?= =?UTF-8?q?o=20Post=20ID=20when=20created,=20so=20they=20don=E2=80=99t=20b?= =?UTF-8?q?e=20needing=20one=20to=20be=20edited.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In `wp_update_comment()` only check if the given `comment_post_ID` is valid if it isn’t `0`. This allows comments that were created programmatically via `wp_insert_comment()` without the (optional) `comment_post_ID` parameter to be edited. Props subharanjan for the initial patch. Fixes #34954 Built from https://develop.svn.wordpress.org/trunk@35853 git-svn-id: http://core.svn.wordpress.org/trunk@35817 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/comment.php | 2 +- wp-includes/version.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/wp-includes/comment.php b/wp-includes/comment.php index 5de9531322..c62a920839 100644 --- a/wp-includes/comment.php +++ b/wp-includes/comment.php @@ -1904,7 +1904,7 @@ function wp_update_comment($commentarr) { } // Make sure that the comment post ID is valid (if specified). - if ( isset( $commentarr['comment_post_ID'] ) && ! get_post( $commentarr['comment_post_ID'] ) ) { + if ( ! empty( $commentarr['comment_post_ID'] ) && ! get_post( $commentarr['comment_post_ID'] ) ) { return 0; } diff --git a/wp-includes/version.php b/wp-includes/version.php index 5208cd99b8..2cda9ff955 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.5-alpha-35850'; +$wp_version = '4.5-alpha-35853'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.