Skip to content

Instantly share code, notes, and snippets.

@tdwesten
Last active February 16, 2023 20:33
Show Gist options
  • Save tdwesten/3402b2c5ef0843df6bb65afbb4835f99 to your computer and use it in GitHub Desktop.
Save tdwesten/3402b2c5ef0843df6bb65afbb4835f99 to your computer and use it in GitHub Desktop.
Fields attributes cheatsheet

Fields attributes cheatsheet

This is a overview of all default attributes associated with the different ACF(pro) fields. This Cheatsheet is quite handy when creating ACF fields with the StoutLogic Acf Builder.

Last update: 27/09/2017 ACF version: 5.6.2

Text field

$attributes = [
    'default_value' => '',
    'maxlength' => '',
    'placeholder' => '',
    'prepend' => '',
    'append' => ''
];

Textarea

$attributes = [
    'default_value' => '',
    'new_lines'	 => '',
    'maxlength' => '',
    'placeholder' => '',
    'rows' => ''
];

Number

$attributes = [
    'default_value' => '',
    'min' => '',
    'max' => '',
    'step' => '',
    'placeholder' => '',
    'prepend' => '',
    'append' => ''
];

Email

$attributes = [
    'default_value' => '',
    'placeholder' => '',
    'prepend' => '',
    'append' => ''
];

Url

$attributes = [
    'default_value' => '',
    'placeholder' => '',
];

Password

$attributes = [
    'placeholder' => '',
    'prepend' => '',
    'append' => '',
];

Range

$attributes = [
    'default_value' => '',
    'min' => '',
    'max' => '',
    'step' => '',
    'prepend' => '',
    'append' => ''
];

Wysiwyg Editor

$attributes = [
    'tabs' => 'all',
    'toolbar' => 'full',
    'media_upload' => 1,
    'default_value' => '',
    'delay' => 0
];

oEmbed

$attributes = [
    'width' => '',
    'height' => '',
];

Image

$attributes = [
    'return_format' => 'array',
    'preview_size' => 'thumbnail',
    'library' => 'all',
    'min_width' => 0,
    'min_height' => 0,
    'min_size' => 0,
    'max_width' => 0,
    'max_height' => 0,
    'max_size' => 0,
    'mime_types' => ''
];

File

$attributes = [
    'return_format'	=> 'array',
    'library' => 'all',
    'min_size' => 0,
    'max_size' => 0,
    'mime_types' => ''
];

Gallery (Pro)

$attributes = [
    'library' => 'all',
    'min' => 0,
    'max' => 0,
    'min_width' => 0,
    'min_height' => 0,
    'min_size' => 0,
    'max_width' => 0,
    'max_height' => 0,
    'max_size' => 0,
    'mime_types' => '',
    'insert' => 'append'
];

Link

$attributes = [
	'return_format'	=> 'array',
];

Post Object

$attributes = [
    'post_type' => array(),
    'taxonomy' => array(),
    'allow_null' => 0,
    'multiple' => 0,
    'return_format'	=> 'object',
    'ui' => 1,
];

Page Link

$attributes = [
    'post_type'	=> array(),
    'taxonomy' => array(),
    'allow_null' => 0,
    'multiple' => 0,
    'allow_archives' => 1
];

Relationship

$attributes = [
    'post_type'	=> array(),
    'taxonomy' => array(),
    'min' => 0,
    'max'  => 0,
    'filters' => array('search', 'post_type', 'taxonomy'),
    'elements' => array(),
    'return_format' => 'object'
];

Taxonomy

$attributes = [
    'taxonomy' => 'category',
    'field_type' => 'checkbox',
    'multiple' => 0,
    'allow_null' => 0,
    'return_format' => 'id',
    'add_term' => 1,
    'load_terms' => 0,
    'save_terms' => 0
];

User

$attributes = [
    'role' => '',
    'multiple' => 0,
    'allow_null' => 0,
];

Select

$attributes = [
    'multiple' => 0,
    'allow_null' => 0,
    'choices' => array(),
    'default_value'	=> '',
    'ui' => 0,
    'ajax' => 0,
    'placeholder' => '',
    'return_format'	=> 'value'
];

Checkbox

$attributes = [
    'layout' => 'vertical',
    'choices' => array(),
    'default_value' => '',
    'allow_custom' => 0,
    'save_custom' => 0,
    'toggle' => 0,
    'return_format' => 'value'
];

Radio

$attributes = [
    'layout' => 'vertical',
    'choices' => array(),
    'default_value' => '',
    'other_choice' => 0,
    'save_other_choice'	=> 0,
    'allow_null' => 0,
    'return_format' => 'value'
];

True / False

$attributes = [
    'default_value'	=> 0,
    'message' => '',
    'ui' => 0,
    'ui_on_text' => '',
    'ui_off_text' => '',
];

Google Map

$attributes = [
    'height' => '',
    'center_lat' => '',
    'center_lng' => '',
    'zoom' => ''
];

Date Picker

$attributes = [
    'display_format' => 'd/m/Y',
    'return_format' => 'd/m/Y',
    'first_day' => 1
];

Date Time Picker

$attributes = [
    'display_format' => 'd/m/Y g:i a',
    'return_format' => 'd/m/Y g:i a',
    'first_day' => 1
];

Time Picker

$attributes = [
    'display_format' => 'g:i a',
    'return_format' => 'g:i a',
];

Color Picker

$attributes = [
    'default_value'	=> 0,
];

Color Picker

$attributes = [
    'default_value'	=> 0,
];

Message

$attributes = [
    'message' => '',
    'esc_html' => 0,
    'new_lines' => 'wpautop',
];

Tab

$attributes = [
    'placement'	=> 'top',
    'endpoint' => 0
];

Group

$attributes = [
    'sub_fields' => array(),
    'layout' => 'block'
];

Repeater

$attributes = [
    'sub_fields' => array(),
    'min' => 0,
    'max' => 0,
    'layout' => 'table',
    'button_label' => '',
    'collapsed' => ''
];

Flexible Content

$attributes = [
    'layouts' => array(),
	'min' => '',
    'max' => '',
	'button_label'=> "Add Row",
];

Clone

Not supported via a arrow function [StoutLogic/acf-builder#37].

$attributes = [
    'clone' => '',
    'prefix_label' => 0,
    'prefix_name' => 0,
    'display' => 'seamless',
    'layout' => 'block'
];
@tdwesten
Copy link
Author

Hi Guys, this gist is not up-to-date any more, pls check; https://github.com/tdwesten/acf-fieldattributes-cheatsheet/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment