abstract class Post_Meta extends Meta

An abstract for dealing with Post Meta.

Properties

protected Meta_Schema $Schema from  Meta
protected string $single from  Meta
protected mixed $data from  Meta
protected WP_Post $Post

Methods

static string
key()

The meta key used in the database.

from  Meta
mixed
load()

The required abstract loading function.

bool
save()

Save the instance data to the database.

mixed
export()

Create a data structure that should be saved in it's own format in the database.

from  Meta
Meta_Schema
get_schema()

Return the Meta schema.

from  Meta
mixed
get_data()

Get the meta data of this instance.

from  Meta
__construct(WP_Post|int $post)

Construct construct the Post Meta, instantiate Post if necessary, call parent constructor.

set_data(mixed $data)

Set the meta data of this instance.

from  Meta
set_schema(Meta_Schema $Schema)

Set the schema for the Meta data.

from  Meta
import(array $data)

Set properties of the class based on an associative array.

from  Meta
WP_Error|bool
validate()

Validate the Meta export values based on the current Schema.

from  Meta
WP_Post
get_post()

Return the Post.

Details

in Meta at line 42
abstract static string key()

The meta key used in the database.

Return Value

string

The meta database key.

at line 75
final mixed load()

The required abstract loading function.

Return Value

mixed

The meta data from the database.

at line 84
final bool save()

Save the instance data to the database.

Return Value

bool

The result of saving the meta to the database. Nota bene: With WordPress functions, the result may return FALSE if the data was the same.

in Meta at line 63
abstract mixed export()

Create a data structure that should be saved in it's own format in the database.

Return Value

mixed

The data as it should be saved into the database.

in Meta at line 70
final Meta_Schema get_schema()

Return the Meta schema.

Return Value

Meta_Schema

The Meta schema.

in Meta at line 77
final protected mixed get_data()

Get the meta data of this instance.

Return Value

mixed

The meta data.

at line 42
__construct(WP_Post|int $post)

Construct construct the Post Meta, instantiate Post if necessary, call parent constructor.

Parameters

WP_Post|int $post

The Post ID or class object.

in Meta at line 95
final protected set_data(mixed $data)

Set the meta data of this instance.

Parameters

mixed $data

The meta data.

in Meta at line 110
final protected set_schema(Meta_Schema $Schema)

Set the schema for the Meta data.

Parameters

Meta_Schema $Schema

The Meta Value to use for the schema.

in Meta at line 119
final import(array $data)

Set properties of the class based on an associative array.

Parameters

array $data

in Meta at line 132
final WP_Error|bool validate()

Validate the Meta export values based on the current Schema.

Return Value

WP_Error|bool

Returns TRUE of the Meta is valid, otherwise returns validation errors.

at line 35
final WP_Post get_post()

Return the Post.

Return Value

WP_Post

The Post the Meta belongs to.