Test explicitly for false from insert()/update(). Fixes early return that preventing link categories from being saved. fixes #12196
git-svn-id: http://svn.automattic.com/wordpress/trunk@13053 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
f147d89df7
commit
dde64e4cf1
|
@ -186,14 +186,14 @@ function wp_insert_link( $linkdata, $wp_error = false ) {
|
|||
}
|
||||
|
||||
if ( $update ) {
|
||||
if ( ! $wpdb->update( $wpdb->links, compact('link_url', 'link_name', 'link_image', 'link_target', 'link_description', 'link_visible', '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_rating', 'link_rel', 'link_notes', 'link_rss'), compact('link_id') ) ) {
|
||||
if ( $wp_error )
|
||||
return new WP_Error( 'db_update_error', __( 'Could not update link in the database' ), $wpdb->last_error );
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
} else {
|
||||
if ( ! $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') ) ) {
|
||||
if ( $wp_error )
|
||||
return new WP_Error( 'db_insert_error', __( 'Could not insert link into the database' ), $wpdb->last_error );
|
||||
else
|
||||
|
|
Loading…
Reference in New Issue