{ "$schema": "https://json-schema.org/draft-07/schema", "title": "Meta Box", "type": "object", "description": "WordPress Custom Fields and Custom Meta Boxes Framework", "definitions": { "//": { "reference": "https://docs.metabox.io/creating-fields-with-code/", "fieldsReference": "https://docs.metabox.io/fields/" }, "geo": { "description": "Enable Place Autocomplete for the address field. Default is false.", "oneOf": [ { "type": "boolean", "description": "Enable Place Autocomplete for the address field. Default is false." }, { "type": "object", "properties": { "api_key": { "type": "string", "description": "Google Maps API key." }, "types": { "type": "array", "description": "Types of places to search for.", "items": { "type": "string", "enum": [ "geocode", "address", "establishment", "(regions)", "(cities)" ] } }, "componentRestrictions": { "type": "object", "properties": { "country": { "type": "string" }, "route": { "type": "string" }, "locality": { "type": "string" }, "administrativeArea": { "type": "string" }, "postalCode": { "type": "string" }, "place": { "type": "string" }, "sublocality": { "type": "string" }, "sublocalityLevel1": { "type": "string" }, "sublocalityLevel2": { "type": "string" }, "sublocalityLevel3": { "type": "string" }, "sublocalityLevel4": { "type": "string" }, "sublocalityLevel5": { "type": "string" }, "subpremise": { "type": "string" } } } } } ] }, "conditionalLogicStatements": { "oneOf": [ { "type": "string", "description": "Simple condition, [name, operator, value]." }, { "type": "array", "description": "Compound statements [[name1, operator1, value1], [name2, operator2,value2], ...] with AND relation", "items": { "oneOf": [ { "type": "array", "items": { "type": "string" } }, { "type": "string" } ] } }, { "type": "object", "description": "Compound statements with selected relation", "properties": { "when": { "type": "array", "description": "Compound statements [[name1, operator1, value1], [name2, operator2,value2], ...] with and relation", "items": { "type": "array", "items": { "type": "string" } } }, "relation": { "type": "string", "enum": [ "and", "or" ] } } } ] }, "visible": { "$ref": "#/definitions/conditionalLogicStatements" }, "hidden": { "$ref": "#/definitions/conditionalLogicStatements" }, "validation": { "type": "object", "properties": { "rules": { "type": "object", "description": "Validation rules. Key is the rule name, value is the rule value." }, "messages": { "type": "object", "description": "Validation messages. Key is the rule name, value is the message." } } } }, "properties": { "$schema": { "type": "string" }, "id": { "type": "string", "description": "ID, must be unique. Optional. If it's absent, it will be generated from the title." }, "title": { "type": "string", "description": "Title of the meta box. Required" }, "type": { "type": "string", "enum": [ "meta-box", "block" ] }, "settings_page": { "type": "string", "description": "Settings page ID. Optional. If it's present, the meta box will be shown on the settings page." }, "tabs": { "type": "object", "description": "ID - Title pairs of tabs. Optional. If it's present, the meta box will be shown in tabs.", "patternProperties": { "^.*$": { "oneOf": [ { "type": "string" }, { "type": "object", "properties": { "label": { "type": "string", "description": "Tab title" }, "icon": { "type": "string", "description": "Tab icon, support dashicons (default), can be class name or URL for custom icon" } }, "required": [ "label" ] } ] } } }, "tab_style": { "type": "string", "enum": [ "default", "box", "left" ] }, "tab_default_active": { "type": "string" }, "tab_remember": { "type": "boolean" }, "geo": { "$ref": "#/definitions/geo" }, "object_type": { "type": "string" }, "post_types": { "oneOf": [ { "type": "string", "default": "post" }, { "type": "array", "items": { "type": "string", "default": "post" } } ], "description": "Custom post types which the field group is for. It can be a string or an array of slugs. Must be lowercase (like the slug)" }, "context": { "type": "string", "enum": [ "normal", "advanced", "side", "form_top", "after_title", "after_editor", "before_permalink" ] }, "style": { "type": "string", "enum": [ "default", "seamless" ] }, "closed": { "type": "boolean" }, "priority": { "type": "string", "enum": [ "high", "low" ] }, "default_hidden": { "type": "boolean" }, "autosave": { "type": "boolean" }, "media_modal": { "type": "boolean" }, "columns": { "type": "object", "description": "Columns settings if you want to show fields in columns.", "patternProperties": { "^.*$": { "oneOf": [ { "type": "integer", "description": "Column size (1-12)." }, { "type": "object", "properties": { "size": { "type": "integer", "description": "Column size (1-12)." }, "class": { "type": "string", "description": "Custom CSS class for the column" } } } ] } } }, "storage_type": { "description": "Storage type of the meta box. Default is post_meta.", "type": "string", "enum": [ "post_meta", "user_meta", "term_meta", "comment_meta", "settings_page", "custom_table" ] }, "table": { "type": "string", "description": "Table name for custom table storage type." }, "custom_table": { "type": "object", "properties": { "enable": { "type": "boolean" }, "name": { "type": "string" }, "prefix": { "type": "boolean" }, "create": { "type": "boolean" } }, "required": [ "enable", "name", "prefix", "create" ] }, "class": { "type": "string" }, "settings": { "type": "object", "properties": { "text_domain": { "type": "string" }, "modified": { "type": "number" }, "function_name": { "type": "string" }, "status": { "type": "string" } }, "additionalProperties": true }, "fields": { "type": "array", "description": "Fields in the meta box", "items": { "type": "object", "properties": { "attributes": { "type": "object", "description": "Custom HTML5 attributes of the field" }, "name": { "type": "string" }, "id": { "type": "string" }, "type": { "type": "string", "enum": [ "autocomplete", "background", "button_group", "button", "checkbox_list", "checkbox", "color", "custom_html", "date", "datetime", "divider", "fieldset_text", "file_advanced", "file_input", "file_upload", "file", "heading", "hidden", "icon", "image_advanced", "image_select", "image_upload", "image", "key_value", "map", "number", "oembed", "osm", "password", "post", "radio", "range", "select_advanced", "select", "sidebar", "single_image", "slider", "switch", "taxonomy_advanced", "taxonomy", "text_list", "text", "textarea", "time", "user", "video", "wysiwyg", "group", "signature" ] }, "options": { "type": "object", "description": "Options of the field. Required for some field types like select, radio, checkbox_list, etc." }, "label_description": { "type": "string" }, "desc": { "type": "string" }, "std": { "type": "string" }, "placeholder": { "oneOf": [ { "type": "string", "description": "Regular fields placeholder" }, { "type": "object", "properties": { "key": { "type": "string" }, "value": { "type": "string" } }, "description": "Placeholder for key-value field" } ] }, "size": { "type": "number" }, "required": { "type": "boolean" }, "disabled": { "type": "boolean" }, "readonly": { "type": "boolean" }, "prepend": { "type": "string" }, "append": { "type": "string" }, "datalist_choices": { "type": "string" }, "clone": { "type": "boolean" }, "sort_clone": { "type": "boolean" }, "clone_default": { "type": "boolean" }, "clone_as_multiple": { "type": "boolean" }, "clone_empty_start": { "type": "boolean" }, "multiple": { "type": "boolean", "description": "Allow multiple values. Default is false." }, "min_clone": { "type": "number" }, "max_clone": { "type": "number" }, "add_button": { "type": "string", "description": "Text for the 'Add' button in cloneable fields." }, "tooltip": { "type": "object", "properties": { "enable": { "type": "boolean" }, "icon": { "type": "string" }, "position": { "type": "string" }, "content": { "type": "string" } }, "required": [ "enable", "icon", "position", "content" ] }, "hide_from_front": { "type": "boolean", "description": "Hide the field from the front end submission form." }, "hide_from_rest": { "type": "boolean", "description": "Hide the field from REST API response." }, "limit": { "type": "integer" }, "limit_type": { "type": "string", "enum": [ "character", "word" ] }, "before": { "type": "string" }, "after": { "type": "string" }, "class": { "type": "string" }, "sanitize_callback": { "type": "string" }, "save_field": { "type": "boolean", "default": true }, "visible": { "$ref": "#/definitions/conditionalLogicStatements" }, "hidden": { "$ref": "#/definitions/conditionalLogicStatements" }, "tab": { "type": "string", "description": "Tab ID to show the field in." }, "columns": { "type": "integer", "description": "Column size (1-12)." }, "column": { "type": "string", "description": "Match the field with a column in the columns settings." } }, "allOf": [ { "if": { "properties": { "type": { "const": "group" } } }, "then": { "required": [ "fields" ] } }, { "if": { "properties": { "type": { "enum": [ "select", "select_advanced", "radio", "checkbox_list", "image_select" ] } } }, "then": { "required": [ "options" ] } } ] }, "additionalProperties": true }, "modified": { "type": "number" }, "revision": { "type": "boolean" }, "visible": { "$ref": "#/definitions/conditionalLogicStatements" }, "hidden": { "$ref": "#/definitions/conditionalLogicStatements" }, "validation": { "$ref": "#/definitions/validation" }, "additionalProperties": true }, "required": [ "id", "title", "fields" ] }