MetaData final class
Minn\Runtime\MetaData · public/minn/src/Minn/Runtime/MetaData.php · 401 lines
Metadata as WordPress's meta functions read and write it, for posts, terms, comments, users and any type a plugin's table names: read through get_{type}_metadata and the object cache (a value its default when unset), written and removed with the filters that may answer first and the actions around each change (post meta also told as postmeta), values sanitized and stored serialized.
Used by 25 (show)
Public
| static | get(mixed $type, mixed $objectId, mixed $key = '', mixed $single = false): mixed# | A value, a key's values, or every key's (get_metadata), the default when the key is unset. | |||
| static | raw(mixed $type, mixed $objectId, mixed $key = '', mixed $single = false): mixed# | What is stored (get_metadata_raw): false for no type or object, null for an unknown type or an unset key; get_{type}_metadata may answer first; else the object's meta, read once into the cache. | |||
| static | fallback(mixed $type, mixed $objectId, mixed $key, mixed $single = false): mixed# | An unset key's value (get_metadata_default): empty, or an empty list, as default_{type}_metadata leaves it. | |||
| static | exists(mixed $type, mixed $objectId, mixed $key): bool# | Whether a key is set for an object (metadata_exists), get_{type}_metadata answering first. | |||
| static | add(mixed $type, mixed $objectId, mixed $key, mixed $value, mixed $unique = false): mixed# | A value added (add_metadata): its id, or false; refused when unique and the key is already set. | |||
| static | update(mixed $type, mixed $objectId, mixed $key, mixed $value, mixed $previous = ''): mixed# | A value changed (update_metadata): every row of the key, or only those holding the previous value given; a key not stored yet is added from the value as it was handed in (and the new row's id answers). | |||
| static | delete(mixed $type, mixed $objectId, mixed $key, mixed $value = '', mixed $all = false): bool# | Values removed (delete_metadata): the key's, or only those holding the value given; for every object when all are asked. | |||
| static | isProtected(mixed $key, mixed $type = ''): mixed# | Whether a key is private to code (is_protected_meta): one starting with an underscore, as the filter leaves it. | |||
| static | sanitize(mixed $key, mixed $value, mixed $objectType, mixed $subtype = ''): mixed# | A value as its key's sanitizer leaves it (sanitize_meta), the subtype's own sanitizer first when one is hooked. | |||
| static | table(string $type): ?array# | A meta type's table, or null when there is none: the built-in types, and a plugin's type by the table it set on $wpdb as "{type}meta". @return list<string>|null | |||
| static | userOption(mixed $option, mixed $user = 0, mixed $deprecated = ''): mixed# | A user's option (get_user_option): the site's prefixed key first, then the bare one; false for nobody or neither; as get_user_option_{option} leaves it. | |||
| static | byMid(mixed $type, mixed $metaId): mixed# | One meta row by its id (get_metadata_by_mid): an object under the table's own column names, the value decoded, unless get_{type}_metadata_by_mid answers first; false when there is none. | |||
| static | updateByMid(mixed $type, mixed $metaId, mixed $value, mixed $key = false): bool# | One meta row rewritten by its id (update_metadata_by_mid), its key too when one is given, with the update actions for that row, unless update_{type}_metadata_by_mid answers first. | |||
| static | deleteByMid(mixed $type, mixed $metaId): bool# | One meta row removed by its id (delete_metadata_by_mid), with the delete actions for that row (posts and comments also told by their older names, with the row id alone), unless delete_{type}_metadata_by_mid answers first. | |||
| static | ofPost(mixed $postId, mixed $key = '', mixed $single = false): mixed# | A post's meta (get_post_meta). | |||
| static | updatePost(mixed $postId, mixed $key, mixed $value, mixed $previous = ''): mixed# | A post's meta changed (update_post_meta). | |||
| static | updateUser(mixed $userId, mixed $key, mixed $value, mixed $previous = ''): mixed# | A user's meta changed (update_user_meta). | |||
| static | postCustom(mixed $postId = 0): mixed# | Every key of a post's meta (get_post_custom), the post being read's when none is named. | |||
| static | primeCache(mixed $type, mixed $objectIds): mixed# | Objects' meta read into the cache together (update_meta_cache): their column asked of sanitize_key, then update_{type}_metadata_cache, which a plugin may answer first; false for no type or no ids. | |||
| static | primeCheck(string $type, array $ids): mixed# | What update_{type}_metadata_cache answers before objects' meta is read into the cache, as update_meta_cache asks it (the column through sanitize_key first): null to read it; any other answer stands for the read.
|
Internals 4
Private and protected methods: how the class does its work. Not a contract; they change whenever the code is tidied.
| private | column(string $type): string# | An object type's meta column, asked of sanitize_key as the reference asks it ({type}_id). |
| private | store(): Minn\Runtime\Meta# | |
| private | announce(string $verb, string $type, array $args, array $legacy): void# | An action told for a meta change, and its postmeta twin for posts. |
| private | rows(): Minn\Runtime\Meta# |
Nothing matches.