From 1439cc5f4095f3a9b7ec01997a95457b013e10c9 Mon Sep 17 00:00:00 2001 From: Jb Audras Date: Tue, 4 Mar 2025 05:53:27 +0000 Subject: [PATCH] Bookmarks: Update `link_updated` when a link is created or updated. This changeset fixes an issue where the `link_updated` field was not updated in the old Link Manager. When a link was created or updated the `link_updated` field remained `0000-00-00 00:00:00`. Props lenasterg, audrasjb. Fixes #56851. git-svn-id: https://develop.svn.wordpress.org/trunk@59923 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-admin/includes/bookmark.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/wp-admin/includes/bookmark.php b/src/wp-admin/includes/bookmark.php index c5600bf38a..03e8b1201c 100644 --- a/src/wp-admin/includes/bookmark.php +++ b/src/wp-admin/includes/bookmark.php @@ -215,6 +215,7 @@ function wp_insert_link( $linkdata, $wp_error = false ) { $link_rss = ( ! empty( $parsed_args['link_rss'] ) ) ? $parsed_args['link_rss'] : ''; $link_rel = ( ! empty( $parsed_args['link_rel'] ) ) ? $parsed_args['link_rel'] : ''; $link_category = ( ! empty( $parsed_args['link_category'] ) ) ? $parsed_args['link_category'] : array(); + $link_updated = gmdate( 'Y-m-d H:i:s', current_time( 'timestamp', 0 ) ); // Make sure we set a valid category. if ( ! is_array( $link_category ) || 0 === count( $link_category ) ) { @@ -222,7 +223,7 @@ function wp_insert_link( $linkdata, $wp_error = false ) { } if ( $update ) { - if ( false === $wpdb->update( $wpdb->links, compact( 'link_url', 'link_name', 'link_image', 'link_target', 'link_description', 'link_visible', 'link_owner', 'link_rating', 'link_rel', 'link_notes', 'link_rss' ), compact( 'link_id' ) ) ) { + if ( false === $wpdb->update( $wpdb->links, compact( 'link_url', 'link_name', 'link_image', 'link_target', 'link_description', 'link_visible', 'link_owner', 'link_rating', 'link_rel', 'link_notes', 'link_rss', 'link_updated' ), compact( 'link_id' ) ) ) { if ( $wp_error ) { return new WP_Error( 'db_update_error', __( 'Could not update link in the database.' ), $wpdb->last_error ); } else { @@ -230,7 +231,7 @@ function wp_insert_link( $linkdata, $wp_error = false ) { } } } else { - if ( false === $wpdb->insert( $wpdb->links, compact( 'link_url', 'link_name', 'link_image', 'link_target', 'link_description', 'link_visible', 'link_owner', 'link_rating', 'link_rel', 'link_notes', 'link_rss' ) ) ) { + if ( false === $wpdb->insert( $wpdb->links, compact( 'link_url', 'link_name', 'link_image', 'link_target', 'link_description', 'link_visible', 'link_owner', 'link_rating', 'link_rel', 'link_notes', 'link_rss', 'link_updated' ) ) ) { if ( $wp_error ) { return new WP_Error( 'db_insert_error', __( 'Could not insert link into the database.' ), $wpdb->last_error ); } else {