WordPress.org

Make WordPress Core

Ticket #21864: return_meta_id.patch

File return_meta_id.patch, 2.4 KB (added by mark8barnes, 6 years ago)
  • wp-includes/comment.php

     
    504504 * @param string $meta_key Metadata name.
    505505 * @param mixed $meta_value Metadata value.
    506506 * @param bool $unique Optional, default is false. Whether the same key should not be added.
    507  * @return bool False for failure. True for success.
     507 * @return bool The meta ID on successful update, false on failure.
    508508 */
    509509function add_comment_meta($comment_id, $meta_key, $meta_value, $unique = false) {
    510510        return add_metadata('comment', $comment_id, $meta_key, $meta_value, $unique);
  • wp-includes/comment.php

     
    504504 * @param string $meta_key Metadata name.
    505505 * @param mixed $meta_value Metadata value.
    506506 * @param bool $unique Optional, default is false. Whether the same key should not be added.
    507  * @return bool False for failure. True for success.
     507 * @return bool The meta ID on successful update, false on failure.
    508508 */
    509509function add_comment_meta($comment_id, $meta_key, $meta_value, $unique = false) {
    510510        return add_metadata('comment', $comment_id, $meta_key, $meta_value, $unique);
  • wp-includes/meta.php

     
    9696 * @param string $meta_value Metadata value
    9797 * @param string $prev_value Optional. If specified, only update existing metadata entries with
    9898 *              the specified value. Otherwise, update all entries.
    99  * @return bool True on successful update, false on failure.
     99 * @return bool The meta ID on successful update, false on failure.
    100100 */
    101101function update_metadata($meta_type, $object_id, $meta_key, $meta_value, $prev_value = '') {
    102102        if ( !$meta_type || !$meta_key )
     
    160160        if ( 'post' == $meta_type )
    161161                do_action( 'updated_postmeta', $meta_id, $object_id, $meta_key, $meta_value );
    162162
    163         return true;
     163        return $meta_id;
    164164}
    165165
    166166/**
  • wp-includes/post.php

     
    14791479 * @param string $meta_key Metadata name.
    14801480 * @param mixed $meta_value Metadata value.
    14811481 * @param bool $unique Optional, default is false. Whether the same key should not be added.
    1482  * @return bool False for failure. True for success.
     1482 * @return bool The meta ID on successful update, false on failure.
    14831483 */
    14841484function add_post_meta($post_id, $meta_key, $meta_value, $unique = false) {
    14851485        // make sure meta is added to the post, not a revision