[ Index ]

PHP Cross Reference of WordPress (latest release)

title

Body

[close]

/wp-includes/ -> meta.php (summary)

Metadata API Functions for retrieving and manipulating metadata of various WordPress object types.  Metadata for an object is a represented by a simple key-value pair.  Objects may contain multiple metadata entries that share the same key and differ only in their value.

File Size: 344 lines (11 kb)
Included or required: 1 time
Referenced: 0 times
Includes or requires: 0 files

Defines 6 functions

  add_metadata()
  update_metadata()
  delete_metadata()
  get_metadata()
  update_meta_cache()
  _get_meta_table()

Functions
Functions that are not part of a class:

add_metadata($meta_type, $object_id, $meta_key, $meta_value, $unique = false)   X-Ref
Add metadata for the specified object.

param: string $meta_type Type of object metadata is for (e.g., comment, post, or user)
param: int $object_id ID of the object metadata is for
param: string $meta_key Metadata key
param: string $meta_value Metadata value
param: bool $unique Optional, default is false.  Whether the specified metadata key should be
return: bool True on successful update, false on failure.

update_metadata($meta_type, $object_id, $meta_key, $meta_value, $prev_value = '')   X-Ref
Update metadata for the specified object.  If no value already exists for the specified object
ID and metadata key, the metadata will be added.

param: string $meta_type Type of object metadata is for (e.g., comment, post, or user)
param: int $object_id ID of the object metadata is for
param: string $meta_key Metadata key
param: string $meta_value Metadata value
param: string $prev_value Optional.  If specified, only update existing metadata entries with
return: bool True on successful update, false on failure.

delete_metadata($meta_type, $object_id, $meta_key, $meta_value = '', $delete_all = false)   X-Ref
Delete metadata for the specified object.

param: string $meta_type Type of object metadata is for (e.g., comment, post, or user)
param: int $object_id ID of the object metadata is for
param: string $meta_key Metadata key
param: string $meta_value Optional. Metadata value.  If specified, only delete metadata entries
param: bool $delete_all Optional, default is false.  If true, delete matching metadata entries
return: bool True on successful delete, false on failure.

get_metadata($meta_type, $object_id, $meta_key = '', $single = false)   X-Ref
Retrieve metadata for the specified object.

param: string $meta_type Type of object metadata is for (e.g., comment, post, or user)
param: int $object_id ID of the object metadata is for
param: string $meta_key Optional.  Metadata key.  If not specified, retrieve all metadata for
param: bool $single Optional, default is false.  If true, return only the first value of the
return: string|array Single metadata value, or array of values

update_meta_cache($meta_type, $object_ids)   X-Ref
Update the metadata cache for the specified objects.

param: string $meta_type Type of object metadata is for (e.g., comment, post, or user)
param: int|array $object_ids array or comma delimited list of object IDs to update cache for
return: mixed Metadata cache for the specified objects, or false on failure.

_get_meta_table($type)   X-Ref
Retrieve the name of the metadata table for the specified object type.

param: string $meta_type Type of object to get metadata table for (e.g., comment, post, or user)
return: mixed Metadata table name, or false if no metadata table exists



Generated: Sat Jul 24 05:40:08 2010 Cross-referenced by PHPXref 0.7