[ Index ]

WordPress Cross Reference

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: 941 lines (28 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

WP_Meta_Query:: (8 methods):
  __construct()
  parse_query_vars()
  get_cast_for_type()
  get_sql()
  _get_meta_table()
  is_protected_meta()
  sanitize_meta()
  register_meta()

Defines 8 functions

  add_metadata()
  update_metadata()
  delete_metadata()
  get_metadata()
  metadata_exists()
  get_metadata_by_mid()
  update_metadata_by_mid()
  delete_metadata_by_mid()
  update_meta_cache()
  get_meta_sql()

Class: WP_Meta_Query  - X-Ref

Container class for a multiple metadata query

__construct( $meta_query = false )   X-Ref
Constructor

param: array $meta_query (optional) A meta query

parse_query_vars( $qv )   X-Ref
Constructs a meta query based on 'meta_*' query vars

param: array $qv The query variables

get_cast_for_type( $type = '' )   X-Ref
Given a meta type, return the appropriate alias if applicable

param: string $type MySQL type to cast meta_value
return: string MySQL type

get_sql( $type, $primary_table, $primary_id_column, $context = null )   X-Ref
Generates SQL clauses to be appended to a main query.

param: string $type Type of meta
param: string $primary_table
param: string $primary_id_column
param: object $context (optional) The main query object
return: array( 'join' => $join_sql, 'where' => $where_sql )

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

param: string $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

is_protected_meta( $meta_key, $meta_type = null )   X-Ref
Determine whether a meta key is protected

param: string $meta_key Meta key
return: bool True if the key is protected, false otherwise.

sanitize_meta( $meta_key, $meta_value, $meta_type )   X-Ref
Sanitize meta value

param: string $meta_key Meta key
param: mixed $meta_value Meta value to sanitize
param: string $meta_type Type of meta
return: mixed Sanitized $meta_value

register_meta( $meta_type, $meta_key, $sanitize_callback, $auth_callback = null )   X-Ref
Register meta key

param: string $meta_type Type of meta
param: string $meta_key Meta key
param: string|array $sanitize_callback A function or method to call when sanitizing the value of $meta_key.
param: string|array $auth_callback Optional. A function or method to call when performing edit_post_meta, add_post_meta, and delete_post_meta capability checks.
param: array $args Arguments

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: mixed $meta_value Metadata value. Must be serializable if non-scalar.
param: bool $unique Optional, default is false. Whether the specified metadata key should be
return: int|bool The meta ID 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: mixed $meta_value Metadata value. Must be serializable if non-scalar.
param: mixed $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: mixed $meta_value Optional. Metadata value. Must be serializable if non-scalar. 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

metadata_exists( $meta_type, $object_id, $meta_key )   X-Ref
Determine if a meta key is set for a given 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.
return: boolean true of the key is set, false if not.

get_metadata_by_mid( $meta_type, $meta_id )   X-Ref
Get meta data by meta ID

param: string $meta_type Type of object metadata is for (e.g., comment, post, or user)
param: int $meta_id ID for a specific meta row
return: object Meta object or false.

update_metadata_by_mid( $meta_type, $meta_id, $meta_value, $meta_key = false )   X-Ref
Update meta data by meta ID

param: string $meta_type Type of object metadata is for (e.g., comment, post, or user)
param: int $meta_id ID for a specific meta row
param: string $meta_value Metadata value
param: string $meta_key Optional, you can provide a meta key to update it
return: bool True on successful update, false on failure.

delete_metadata_by_mid( $meta_type, $meta_id )   X-Ref
Delete meta data by meta ID

param: string $meta_type Type of object metadata is for (e.g., comment, post, or user)
param: int $meta_id ID for a specific meta row
return: bool True on successful delete, false on failure.

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_sql( $meta_query, $type, $primary_table, $primary_id_column, $context = null )   X-Ref
Given a meta query, generates SQL clauses to be appended to a main query

param: array $meta_query A meta query
param: string $type Type of meta
param: string $primary_table
param: string $primary_id_column
param: object $context (optional) The main query object
return: array( 'join' => $join_sql, 'where' => $where_sql )



Generated: Tue Mar 25 01:41:18 2014 WordPress honlapkészítés: online1.hu