mirror of
https://github.com/WordPress/WordPress.git
synced 2025-01-22 08:11:52 +01:00
Clear the object term relationships cache in wp_set_object_terms() rather than wp_set_post_terms(). This should be done lower in the stack than wp_set_post_terms().
Props batmoo fixes #22560 git-svn-id: http://core.svn.wordpress.org/trunk@22878 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
e2bc567095
commit
b237423e72
@ -3196,13 +3196,7 @@ function wp_set_post_terms( $post_id = 0, $tags = '', $taxonomy = 'post_tag', $a
|
|||||||
$tags = array_unique( array_map( 'intval', $tags ) );
|
$tags = array_unique( array_map( 'intval', $tags ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
$r = wp_set_object_terms( $post_id, $tags, $taxonomy, $append );
|
return wp_set_object_terms( $post_id, $tags, $taxonomy, $append );
|
||||||
if ( is_wp_error( $r ) )
|
|
||||||
return $r;
|
|
||||||
|
|
||||||
wp_cache_delete( $post_id, $taxonomy . '_relationships' );
|
|
||||||
|
|
||||||
return $r;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -2238,6 +2238,8 @@ function wp_set_object_terms($object_id, $terms, $taxonomy, $append = false) {
|
|||||||
return new WP_Error( 'db_insert_error', __( 'Could not insert term relationship into the database' ), $wpdb->last_error );
|
return new WP_Error( 'db_insert_error', __( 'Could not insert term relationship into the database' ), $wpdb->last_error );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
wp_cache_delete( $object_id, $taxonomy . '_relationships' );
|
||||||
|
|
||||||
do_action('set_object_terms', $object_id, $terms, $tt_ids, $taxonomy, $append, $old_tt_ids);
|
do_action('set_object_terms', $object_id, $terms, $tt_ids, $taxonomy, $append, $old_tt_ids);
|
||||||
return $tt_ids;
|
return $tt_ids;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user