get_acpt_fields
Fetch all field values for a meta box
Fetch all field values for a meta box.
Usage
$fields = get_acpt_fields([
'post_id' => 123,
'box_name' => 'box',
]);Parameters
post_id
integer
Conditional
The post ID
term_id
integer
Conditional
The term ID
user_id
integer
Conditional
The user ID
comment_id
integer
Conditional
The comment ID
wc_product_attribute
integer
Conditional
The WooCommerce product attribute ID
option_page
string
Conditional
The option page slug
box_name
string
Optional
The meta box name. If omitted, all boxes/groups for the given context are returned
assoc
boolean
Optional
Set to true to return an associative array keyed by field db-name instead of a numeric array
format
string
Optional
only_value (default) returns raw values only; complete also includes field settings and metadata
with_context
boolean
Optional
Wrap each returned value in a {before, value, after} object
all_users
boolean
Optional
For User fields: return the value regardless of whether the target user still exists
return
string
Optional
object (default) returns relational fields as their native WordPress object. raw returns the raw stored ID(s) instead
Exactly one of post_id, term_id, user_id, comment_id, option_page, or wc_product_attribute must be provided to identify the location.
Return
array
An array of field value entries. Returns an empty array if no fields are found
Last updated