Class: AC\Column\CustomField

The AC\Column\CustomField class contains the properties, options, and methods of a custom field column. The class extends both the AC\Column\Meta class and the AC\Column class and inherits all its methods.

The main scenario where you might want to use AC\Column\CustomField is when you have been using a filter or action to hook into Admin Columns and one of the callback values is a Custom Field column object.

Please read over the extended comments found above each function to learn more.

/admin-columns/classes/Column/CustomField.php on github.
/admin-columns/classes/Column/Meta.php on github.
/admin-columns/classes/Column.php on github.


Method and properties

get_type(): string

Returns column-meta. The column type identifier.


get_meta_key(): string

Returns the selected meta key of the custom field column.


get_meta_type(): string

Returns the custom field meta type. e.g. post, user, comment and term.


get_raw_value( int $id ): mixed

Returns the actual custom field value (for a post or user).

It is a wrapper method for `get_meta_value`.


get_meta_value( int $id, string $meta_key, $single = true ): mixed

Returns the actual custom field value (for a post or user).


is_serialized(): bool

Returns the true when the stored data is serialized.


get_field_type(): string

Returns the field type of the custom fied column. e.g. excerpt, color, date, numeric, image, link, checkmark, library_id, title_by_id, user_by_id.


Field Types

The custom field type mapping is as follows:

Field Label Field Key
Default ''
Basic
Color color
Date date
Image image
Number numeric
Text excerpt
URL link
Choice
Has Content has_content
True / False checkmark
Relational
Media library_id
Post title_by_id
User user_by_id
Multiple
Multiple Values array
Number of Fields count

Example Usage

In these examples we change the column value of the `Custom Field` column with the use of the ac/column/value filter: View examples.

Still need help? Contact Us Contact Us