Changeset 61274 for branches/6.9/src/wp-includes/comment.php
- Timestamp:
- 11/20/2025 01:58:35 PM (4 months ago)
- Location:
- branches/6.9
- Files:
-
- 2 edited
-
. (modified) (1 prop)
-
src/wp-includes/comment.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/6.9
-
branches/6.9/src/wp-includes/comment.php
r61199 r61274 1575 1575 * 1576 1576 * @since 2.9.0 1577 * @since 6.9.0 Any child notes are deleted when deleting a note. 1577 1578 * 1578 1579 * @param int|WP_Comment $comment_id Comment ID or WP_Comment object. … … 1581 1582 function wp_trash_comment( $comment_id ) { 1582 1583 if ( ! EMPTY_TRASH_DAYS ) { 1583 return wp_delete_comment( $comment_id, true ); 1584 $comment = get_comment( $comment_id ); 1585 $success = wp_delete_comment( $comment_id, true ); 1586 1587 if ( ! $success ) { 1588 return false; 1589 } 1590 1591 // Also delete children of top level 'note' type comments. 1592 if ( $comment && 'note' === $comment->comment_type && 0 === (int) $comment->comment_parent ) { 1593 $children = $comment->get_children( 1594 array( 1595 'fields' => 'ids', 1596 'status' => 'all', 1597 'type' => 'note', 1598 ) 1599 ); 1600 1601 foreach ( $children as $child_id ) { 1602 if ( ! wp_delete_comment( $child_id, true ) ) { 1603 $success = false; 1604 } 1605 } 1606 } 1607 1608 return $success; 1584 1609 } 1585 1610 … … 1616 1641 */ 1617 1642 do_action( 'trashed_comment', $comment->comment_ID, $comment ); 1643 1644 // For top level 'note' type comments, also trash children. 1645 if ( 'note' === $comment->comment_type && 0 === (int) $comment->comment_parent ) { 1646 $children = $comment->get_children( 1647 array( 1648 'fields' => 'ids', 1649 'status' => 'all', 1650 'type' => 'note', 1651 ) 1652 ); 1653 1654 $success = true; 1655 foreach ( $children as $child_id ) { 1656 if ( ! wp_trash_comment( $child_id ) ) { 1657 $success = false; 1658 } 1659 } 1660 return $success; 1661 } 1618 1662 1619 1663 return true;
Note: See TracChangeset
for help on using the changeset viewer.