Changes in trunk/wp-includes/meta.php [19054:20435]
- File:
-
- 1 edited
-
trunk/wp-includes/meta.php (modified) (11 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/meta.php
r19054 r20435 3 3 * Metadata API 4 4 * 5 * Functions for retrieving and manipulating metadata of various WordPress object types. Metadata6 * for an object is a represented by a simple key-value pair. Objects may contain multiple5 * Functions for retrieving and manipulating metadata of various WordPress object types. Metadata 6 * for an object is a represented by a simple key-value pair. Objects may contain multiple 7 7 * metadata entries that share the same key and differ only in their value. 8 8 * … … 24 24 * @param string $meta_key Metadata key 25 25 * @param string $meta_value Metadata value 26 * @param bool $unique Optional, default is false. Whether the specified metadata key should be27 * unique for the object. If true, and the object already has a value for the specified26 * @param bool $unique Optional, default is false. Whether the specified metadata key should be 27 * unique for the object. If true, and the object already has a value for the specified 28 28 * metadata key, no change will be made 29 29 * @return bool The meta ID on successful update, false on failure. … … 81 81 82 82 /** 83 * Update metadata for the specified object. If no value already exists for the specified object83 * Update metadata for the specified object. If no value already exists for the specified object 84 84 * ID and metadata key, the metadata will be added. 85 85 * … … 95 95 * @param string $meta_key Metadata key 96 96 * @param string $meta_value Metadata value 97 * @param string $prev_value Optional. If specified, only update existing metadata entries with98 * the specified value. Otherwise, update all entries.97 * @param string $prev_value Optional. If specified, only update existing metadata entries with 98 * the specified value. Otherwise, update all entries. 99 99 * @return bool True on successful update, false on failure. 100 100 */ … … 175 175 * @param int $object_id ID of the object metadata is for 176 176 * @param string $meta_key Metadata key 177 * @param string $meta_value Optional. Metadata value. If specified, only delete metadata entries178 * with this value. Otherwise, delete all entries with the specified meta_key.179 * @param bool $delete_all Optional, default is false. If true, delete matching metadata entries180 * for all objects, ignoring the specified object_id. Otherwise, only delete matching177 * @param string $meta_value Optional. Metadata value. If specified, only delete metadata entries 178 * with this value. Otherwise, delete all entries with the specified meta_key. 179 * @param bool $delete_all Optional, default is false. If true, delete matching metadata entries 180 * for all objects, ignoring the specified object_id. Otherwise, only delete matching 181 181 * metadata entries for the specified object_id. 182 182 * @return bool True on successful delete, false on failure. … … 224 224 do_action( "delete_{$meta_type}_meta", $meta_ids, $object_id, $meta_key, $_meta_value ); 225 225 226 // Old-style action. 226 227 if ( 'post' == $meta_type ) 227 228 do_action( 'delete_postmeta', $meta_ids ); … … 244 245 do_action( "deleted_{$meta_type}_meta", $meta_ids, $object_id, $meta_key, $_meta_value ); 245 246 247 // Old-style action. 246 248 if ( 'post' == $meta_type ) 247 249 do_action( 'deleted_postmeta', $meta_ids ); … … 257 259 * @param string $meta_type Type of object metadata is for (e.g., comment, post, or user) 258 260 * @param int $object_id ID of the object metadata is for 259 * @param string $meta_key Optional. Metadata key.If not specified, retrieve all metadata for261 * @param string $meta_key Optional. Metadata key. If not specified, retrieve all metadata for 260 262 * the specified object. 261 * @param bool $single Optional, default is false. If true, return only the first value of the262 * specified meta_key. This parameter has no effect if meta_key is not specified.263 * @param bool $single Optional, default is false. If true, return only the first value of the 264 * specified meta_key. This parameter has no effect if meta_key is not specified. 263 265 * @return string|array Single metadata value, or array of values 264 266 */ … … 486 488 do_action( "delete_{$meta_type}_meta", (array) $meta_id, $object_id, $meta->meta_key, $meta->meta_value ); 487 489 488 if ( 'post' == $meta_type ) 489 do_action( 'delete_postmeta', $meta_id ); 490 // Old-style action. 491 if ( 'post' == $meta_type || 'comment' == $meta_type ) 492 do_action( "delete_{$meta_type}meta", $meta_id ); 490 493 491 494 // Run the query, will return true if deleted, false otherwise 492 $result = (bool) $wpdb-> query( $wpdb->prepare( "DELETE FROM $table WHERE $id_column = %d LIMIT 1;",$meta_id ) );495 $result = (bool) $wpdb->delete( $table, array( $id_column => $meta_id ) ); 493 496 494 497 // Clear the caches. … … 497 500 do_action( "deleted_{$meta_type}_meta", (array) $meta_id, $object_id, $meta->meta_key, $meta->meta_value ); 498 501 499 if ( 'post' == $meta_type ) 500 do_action( 'deleted_postmeta', $meta_id ); 502 // Old-style action. 503 if ( 'post' == $meta_type || 'comment' == $meta_type ) 504 do_action( "deleted_{$meta_type}meta", $meta_id ); 501 505 502 506 return $result; … … 862 866 add_filter( "auth_{$meta_type}_meta_{$meta_key}", $auth_callback, 10, 6 ); 863 867 } 864 865 ?>
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)