Changeset 48215 for trunk/src/wp-includes/comment.php
- Timestamp:
- 06/29/2020 10:42:08 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/comment.php
r48214 r48215 2428 2428 * @param array $commentarr Contains information on the comment. 2429 2429 * @param bool $wp_error Optional. Whether to return a WP_Error on failure. Default false. 2430 * @return int| bool|WP_Error Comment was updated if value is 1, or was not updated if value is 0,2431 * false, or a WP_Error object.2430 * @return int|false|WP_Error The value 1 if the comment was updated, 0 if not updated. 2431 * False or a WP_Error object on failure. 2432 2432 */ 2433 2433 function wp_update_comment( $commentarr, $wp_error = false ) { … … 2437 2437 $comment = get_comment( $commentarr['comment_ID'], ARRAY_A ); 2438 2438 if ( empty( $comment ) ) { 2439 if ( ! $wp_error ) { 2439 if ( $wp_error ) { 2440 return new WP_Error( 'invalid_comment_id', __( 'Invalid comment ID.' ) ); 2441 } else { 2440 2442 return 0; 2441 2443 } 2442 2443 return new WP_Error( 'invalid_comment_id', __( 'Invalid comment ID.' ) );2444 2444 } 2445 2445 2446 2446 // Make sure that the comment post ID is valid (if specified). 2447 2447 if ( ! empty( $commentarr['comment_post_ID'] ) && ! get_post( $commentarr['comment_post_ID'] ) ) { 2448 if ( ! $wp_error ) { 2448 if ( $wp_error ) { 2449 return new WP_Error( 'invalid_post_id', __( 'Invalid post ID.' ) ); 2450 } else { 2449 2451 return 0; 2450 2452 } 2451 2452 return new WP_Error( 'invalid_post_id', __( 'Invalid post ID.' ) );2453 2453 } 2454 2454 … … 2491 2491 * Filters the comment data immediately before it is updated in the database. 2492 2492 * 2493 * Note: data being passed to the filter is already unslashed. Returning 0 or a2494 * WP_Error object is preventing the comment to beupdated.2493 * Note: data being passed to the filter is already unslashed. Returning false 2494 * or a WP_Error object would prevent the comment from being updated. 2495 2495 * 2496 2496 * @since 4.7.0 … … 2500 2500 * @param array $comment The old, unslashed comment data. 2501 2501 * @param array $commentarr The new, raw comment data. 2502 * @param bool $wp_error Optional. Whether to return a WP_Error on failure. 2503 * Default false. 2502 * @param bool $wp_error Whether to return a WP_Error on failure. 2504 2503 */ 2505 2504 $data = apply_filters( 'wp_update_comment_data', $data, $comment, $commentarr, $wp_error ); 2506 2505 2507 2506 // Do not carry on on failure. 2508 if ( is_wp_error( $data ) || 0 ===$data ) {2507 if ( is_wp_error( $data ) || ! $data ) { 2509 2508 return $data; 2510 2509 }
Note: See TracChangeset
for help on using the changeset viewer.