Field Data
The data of a table field is stored in the WordPress database as a serialized array. Depending on where the table data is processed, it is either a PHP array, a JavaScript object, or a JSON string. There is also a formatted and unformatted version of the data depending on the $format_value
parameter used in get_field()
and get_sub_field()
.
Example table
Here is an example of a simple table and the raw data stored in the database expressed as JSON.
A | B |
---|---|
1 | some |
2 | thing |
The example table data as JSON
{
"t":{ // stores table meta data
"o":{ // the table options
"ca":"", // caption
"ct":"ed", // content type
"tb":"basic", // toolbar for wysiwyg editor
"uh":"y", // use header
"uf":"n", // use footer
"sc":"n", // use stub column
"st":"", // styles
"cols": 2, // amount of columns
"rows": 3, // amount of rows
"changed": true // default table was changed
}
},
"c":[ // table columns
{ // the columns row
"c": [ // column entries
{ // a column
"o":{} // options a this column
},
{
"o":{}
}
]
},
],
"h":[ // table header
{ // the header row
"c": [ // header cells
{ // a header cell
"c":"A", // a header cell content
"o":{} // a header cell options
},
{
"c":"B",
"o": {}
}
],
"o":{} // the header row options
},
],
"b":[ // table body
{ // a table body row
"c": [ // a body row cells
{
"c":"1", // a body cell content
"o":{} // a body cell options
},
{
"c":"some",
"o":{}
}
],
"o":{} // a body row options
},
{
"c": [
{
"c":"2",
"o":{}
},
{
"c":"thing",
"o":{}
}
],
"o":{}
}
],
"p":[ // general parameters
"v": "1.0.0", // the plugin version used to save the data
"fk": "field_664dcdcdd4983", // field key
"fn": "table" // field name
],
}
Depending on where the table field data is processed, it is a PHP array, a Javascript object or a JSON string.
Table Object
Table options structure
{
"t":{
"o":{
"uh":"y"
}
}
}
The object "t"
stands for parameters of this table. This parameter object has an object "o"
which stands for options.
Table options list
Name | Decription | Type | Value | Module |
---|---|---|---|---|
ca | Table caption | string | caption | |
changed | Whether the table content was edited | boolean | false/true | main |
uh | Use header | string | y/n | thead |
uf | Use footer | string | y/n | tfoot |
cols | Amount of the table body colums | integer | cols_rows_limit | |
rows | Amount of the table body rows | integer | cols_rows_limit | |
ct | Content type of cells | string | st/ed | cell_content_type |
tb | Toolbar for wysiwyg editor | string | full/basic | editor |
st | Style | string | table_styles | |
sc | Stub Column | string | y/n | stub_column |