Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
This repository was archived by the owner on Sep 24, 2018. It is now read-only.
This repository was archived by the owner on Sep 24, 2018. It is now read-only.

Support objects and arrays in Meta and Settings #2859

Copy link
Copy link

Description

@joehoyle
Issue body actions

Object / Arrays in Meta

Currently, meta for posts, users, terms and comments support scalar values in the registered meta
keys. That's booleans, strings and numbers. For comparison, the Custom Fields meta box only allows
string values.

The response format of meta allows for arrays / objects as values, however these types are currently
not accepted in the PHP API via register_meta. There is a clear path forward to allow developers to register meta keys in the REST API using arrays and objects, however as the underlaying register_meta API doesn't support this either yet, it's my recommendation that this wait until a future release.

Object / Arrays in Settings

Currently, settings support scalar values, this is primarily to keep strict data types when
performing validation / sanitization on values to make them match the Schema. Also, all of the WordPress Admin Settings are scalar values.

The WordPress.com API has only one key that is not a scalar, jetpack_protect_whitelist which
accepts an array of IP Addresses, which has specific sanitizing. There's no support for developers
to add settings, and therefore doesn't need to solve this issue generically.

Like meta, the format in the response would allow objects and arrays, it's instead a limitation of the PHP API via register_setting to support object and arrays. Again, this is a clear path forward to add this without breaking any compatibility, it's my recommendation that this wait until a future release.

Reactions are currently unavailable

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    Morty Proxy This is a proxified and sanitized view of the page, visit original site.