Documentation

FixInvalidJsonInDb
in package

Migration tools can corrupt JSON in database by search & replace domains. For example, the data `["example.com"]` can be transformed to `['example.com']` with invalid single quotes.

Tags
see
https://app.clickup.com/t/863g4efkw

Table of Contents

Properties

$hookedIntoMetadata  : mixed
$json5Supported  : mixed
$metadataSingleMetaKey  : mixed

Methods

__construct()  : mixed
C'tor.
ensureValidJsonString()  : mixed
Ensure a passed string value is a valid JSON string.
fixMetadataBySingleMetaKey()  : mixed
Register a fixer for posts, terms, users, ... metadata.
get_metadata()  : mixed
Only used for internal usage.
get_metadata_raw()  : mixed
Proxy to `get_metadata_raw` with our filter deactivated.
hookMetadata()  : mixed
Hook into retriving the metadata for posts, terms, users, .

Properties

Methods

ensureValidJsonString()

Ensure a passed string value is a valid JSON string.

public ensureValidJsonString(string $val) : mixed
Parameters
$val : string

fixMetadataBySingleMetaKey()

Register a fixer for posts, terms, users, ... metadata.

public fixMetadataBySingleMetaKey(string $expectMetaKey[, string $expectMetaType = 'post' ]) : mixed
Parameters
$expectMetaKey : string
$expectMetaType : string = 'post'

get_metadata()

Only used for internal usage.

public get_metadata(mixed $value, int $object_id, string $meta_key, bool $single, string $meta_type) : mixed
Parameters
$value : mixed

The value to return, either a single metadata value or an array of values depending on the value of $single. Default null.

$object_id : int

ID of the object metadata is for.

$meta_key : string

Metadata key.

$single : bool

Whether to return only the first value of the specified $meta_key

$meta_type : string

Type of object metadata is for. Accepts 'post', 'comment', 'term', 'user', or any other object type with an associated meta table.

Tags
see
https://developer.wordpress.org/reference/hooks/get_meta_type_metadata/

get_metadata_raw()

Proxy to `get_metadata_raw` with our filter deactivated.

protected get_metadata_raw(string $meta_type, int $object_id, string $meta_key, bool $single) : mixed
Parameters
$meta_type : string
$object_id : int
$meta_key : string
$single : bool

hookMetadata()

Hook into retriving the metadata for posts, terms, users, .

protected hookMetadata([string $meta_type = 'post' ]) : mixed

..

Parameters
$meta_type : string = 'post'

        
On this page

Search results