Secure Custom Fields 文档
Secure Custom Fields 文档,介绍字段组与安全相关用法。
- Undocumented Code Elements
- Acf Bidirectional Functions Global Functions
- Acf Field Functions Global Functions
- Acf Field Group Functions Global Functions
- Acf Form Functions Global Functions
- Acf Helper Functions Global Functions
- Acf Hook Functions Global Functions
- Acf Input Functions Global Functions
- Acf Internal Post Type Functions Global Functions
- Acf Meta Functions Global Functions
- Acf Post Functions Global Functions
- Acf Post Type Functions Global Functions
- Acf Taxonomy Functions Global Functions
- Acf User Functions Global Functions
- Acf Utility Functions Global Functions
- Acf Value Functions Global Functions
- Acf Wp Functions Global Functions
- Assets Global Functions
- Blocks Global Functions
- Compatibility Global Functions
- Datastore Global Functions
- Deprecated Global Functions
- Fields Global Functions
- Code Reference
- L10n Global Functions
- Local Fields Global Functions
- Local Json Global Functions
- Local Meta Global Functions
- Locations Global Functions
- Loop Global Functions
- Revisions Global Functions
- Scf Ui Options Page Functions Global Functions
- Upgrades Global Functions
- Validation Global Functions
- Admin Commands Global Functions
- Admin Notices Global Functions
- Admin Tools Global Functions
- Beta Features Global Functions
- Admin
- Admin Views Global
- Navigation Global Functions
- API Helpers Global Functions
- API Template Global Functions
- API Term Global Functions
- Api
- ACF_Repeater_Table
- Fields
- Form Front Global Functions
- Forms
- Hooks
- Acf Rest API Functions Global Functions
- ACF_Rest_Api
- ACF_Rest_Embed_Links
- ACF_Rest_Request
- SCF_Rest_Types_Endpoint
- REST API
- Architecture
- Core Concepts
- Features
- Local JSON
- Custom Post Types
- API Reference
- Field Documentation Guide
- Field Types
- Accordion Field
- Using the Accordion Field
- Button Group Field
- Using the Button Group Field
- Checkbox Field
- Using the Checkbox Field
- Clone Field
- Using the Clone Field
- Color Picker Field
- Using the Color Picker Field
- Date Picker Field
- Using the Date Picker Field
- Date Time Picker Field
- Using the Date Time Picker Field
- Email Field
- Using the Email Field
- File Field
- Using the File Field
- Flexible Content Field
- Using the Flexible Content Field
- Gallery Field
- Using the Gallery Field
- Google Map Field
- Using the Google Map Field
- Group Field
- Using the Group Field
- Icon Picker Field
- Using the Icon Picker Field
- Image Field
- Using the Image Field
- Link Field
- Using the Link Field
- Message Field
- Using the Message Field
- Nav Menu Field
- **Using the Nav Menu Field**
- Number Field
- Using the Number Field
- oEmbed Field
- Using the oEmbed Field
- Page Link Field
- Using the Page Link Field
- Password Field
- Using the Password Field
- Post Object Field
- Using the Post Object Field
- Radio Field
- Using the Radio Field
- Range Field
- Using the Range Field
- Repeater Field
- Using the Repeater Field
- Select Field
- Using the Select Field
- Separator Field
- Using the Separator Field
- Tab Field
- Using the Tab Field
- Taxonomy Field
- Using the Taxonomy Field
- Text Field
- Using the Text Field
- Textarea Field
- Using the Textarea Field
- Time Picker Field
- Using the Time Picker Field
- True/False Field
- Using the True/False Field
- URL Field
- Using the URL Field
- User Field
- Using the User Field
- WYSIWYG Field
- Using the WYSIWYG Field
- Creating Your First Custom Field
- Creating Your First Options Page
- Creating Your First Post Type
- Creating Your First Taxonomy
- Tutorials
- Understanding the Relationship Between Post Types, Taxonomies, and Custom Fields
- Getting Started with Secure Custom Fields
- Quick Start Guide
Undocumented Code Elements
This file tracks code elements that need documentation.
Blocks/Bindings.php
Hooks
acf/bindings/field_not_allowed_messageacf/bindings/field_not_supported_messageacf/blocks/binding_value
Datastore/Localization.php
Hooks
acf/prepare_fieldacf/prepare_fieldacf/prepare_fieldacf/prepare_fieldacf/prepare_fieldacf/prepare_field
Datastore/REST_Save.php
Hooks
acf/prepare_field
abilities/class-scf-field-abilities.php
Hooks
scf_field_parent_exists
acf-bidirectional-functions.php
Hooks
acf/bidirectional/supported_field_types_for_postacf/bidirectional/supported_target_field_types
acf-field-functions.php
Hooks
acf/clone_fieldacf/duplicate_fieldacf/field_wrapper_attributesacf/get_field_countacf/get_field_labelacf/get_sub_fieldacf/is_field_keyacf/load_fieldacf/load_fieldsacf/pre_render_fieldacf/pre_render_fieldsacf/prepare_fieldacf/prepare_field_for_exportacf/prepare_field_for_importacf/prepare_fields_for_importacf/translate_fieldacf/update_fieldacf/validate_field
acf-field-group-functions.php
Hooks
acf/field_group/additional_group_settings_tabsacf/get_field_group_styleacf/get_field_group_title
acf-form-functions.php
Hooks
acf/input/form_dataacf/save_post
acf-helper-functions.php
Hooks
acf/get_cache_keyacf/slugify
acf-internal-post-type-functions.php
Hooks
acf/post_type/additional_settings_tabsacf/taxonomy/additional_settings_tabsacf/ui_options_page/additional_settings_tabs
acf-meta-functions.php
Hooks
acf/load_metaacf/pre_delete_metadataacf/pre_delete_metadataacf/pre_load_metaacf/pre_load_metadataacf/pre_load_metadataacf/pre_update_metadataacf/pre_update_metadata
acf-user-functions.php
Hooks
acf/allow_unfiltered_html
acf-value-functions.php
Hooks
acf/format_valueacf/get_invalid_field_valueacf/load_referenceacf/load_valueacf/pre_format_valueacf/pre_load_metadataacf/pre_load_referenceacf/pre_load_valueacf/pre_update_valueacf/prevent_access_to_unknown_fieldsacf/preview_valueacf/update_value
acf-wp-functions.php
Hooks
acf/decode_post_idacf/get_object_type
admin/admin-internal-post-type-list.php
Hooks
acf/internal_post_type_list/admin_body_classesacf/internal_post_type_list/current_screen
admin/admin-internal-post-type.php
Hooks
acf/internal_post_type/admin_body_classesacf/internal_post_type/current_screen
admin/admin-tools.php
Hooks
acf/include_admin_tools
admin/admin.php
Hooks
acf/admin/prevent_escaped_html_noticeacf/in_admin_header
admin/beta-features.php
Hooks
scf/include_admin_beta_features
admin/class-acf-admin-options-page.php
Hooks
acf/input/meta_box_priority
admin/post-types/admin-field-group.php
Hooks
acf/field_group/admin_enqueue_scriptsacf/field_group/admin_footeracf/field_group/admin_headacf/field_group/admin_l10nacf/field_group/disable_field_settings_tabsacf/field_group/form_dataacf/update_field_groupacf/update_field_group
admin/post-types/admin-field-groups.php
Hooks
acf/field_group/list_table_classes
admin/post-types/admin-post-type.php
Hooks
acf/post_type/admin_enqueue_scriptsacf/post_type/admin_footeracf/post_type/admin_headacf/post_type/admin_l10nacf/post_type/form_data
admin/post-types/admin-taxonomy.php
Hooks
acf/taxonomy/admin_enqueue_scriptsacf/taxonomy/admin_footeracf/taxonomy/admin_headacf/taxonomy/admin_l10nacf/taxonomy/form_data
admin/post-types/class-acf-admin-ui-options-page.php
Hooks
acf/ui_options_page/admin_enqueue_scriptsacf/ui_options_page/admin_footeracf/ui_options_page/admin_headacf/ui_options_page/admin_l10nacf/ui_options_page/form_data
admin/views/acf-field-group/conditional-logic.php
Hooks
acf/conditional_logic/choices
admin/views/acf-field-group/field.php
Hooks
acf/field_group/enable_field_browseracf/field_group/enable_field_type_select2acf/render_field_settings
admin/views/acf-field-group/fields.php
Hooks
acf/field_group/auto_add_first_field
admin/views/acf-field-group/options.php
Hooks
acf/field_group/render_additional_group_settingsacf/field_group/render_additional_location_settingsacf/field_group/render_additional_presentation_settingsacf/render_field_group_settings
admin/views/acf-post-type/advanced-settings.php
Hooks
acf/post_type/available_supports
admin/views/acf-post-type/basic-settings.php
Hooks
acf/post_type/basic_settings
admin/views/acf-taxonomy/basic-settings.php
Hooks
acf/taxonomy/basic_settings
admin/views/acf-ui-options-page/basic-settings.php
Hooks
acf/post_type/basic_settings
admin/views/acf-ui-options-page/create-options-page-modal.php
Hooks
acf/options_page_modal/prefill_title
admin/views/global/form-top.php
Hooks
acf/field_group/prefill_titleenter_title_here
admin/views/global/navigation.php
Hooks
acf/admin/toolbar
ajax/class-acf-ajax-check-screen.php
Hooks
acf/ajax/check_screen/response
ajax/class-acf-ajax-query-users.php
Hooks
acf/ajax/query_users/argsacf/ajax/query_users/resultacf/ajax/query_users/resultsacf/ajax/query_users/search_columns
api/api-helpers.php
Functions
_acf_settings_uploaderacf_decode_choicesacf_get_image_sizeacf_get_post_titleacf_get_pretty_post_typesacf_maybe_get_GETacf_maybe_get_POSTacf_order_by_search
Hooks
acf/acf_get_posts/argsacf/acf_get_posts/resultsacf/connect_attachment_to_postacf/current_user_can_edit_in_contextacf/current_user_can_edit_postacf/filesizeacf/get_image_sizesacf/get_post_id_infoacf/get_post_statiacf/get_post_typesacf/load_attachmentacf/pre_load_attachmentacf/pre_load_post_idacf/validate_attachmentacf/validate_post_idacf/validate_settingacf/verify_ajax
api/api-template.php
Functions
acf_filter_post_idget_rowget_row_indexrender_fieldreset_the_repeater_fieldthe_flexible_fieldthe_repeater_fieldthe_row_index
Hooks
acf/admin/prevent_escaped_html_noticeacf/ajax/shortcode_capabilityacf/prevent_access_to_unknown_fieldsacf/removed_unsafe_htmlacf/removed_unsafe_htmlacf/removed_unsafe_htmlacf/shortcode/allow_in_block_themes_outside_contentacf/shortcode/allow_unsafe_htmlacf/shortcode/disabled_messageacf/shortcode/display_admin_errorsacf/shortcode/field_not_allowed_messageacf/shortcode/field_not_supported_messageacf/shortcode/post_not_public_messageacf/shortcode/prevent_accessacf/shortcode/prevent_access_to_fields_on_non_public_postsacf/shortcode/preview_capabilityacf/shortcode/preview_capability_messageacf/the_field/allow_unsafe_htmlacf/the_field/allow_unsafe_html
api/api-term.php
Hooks
acf/get_taxonomies
assets.php
Hooks
acf/admin_print_footer_scriptsacf/admin_print_scriptsacf/enqueue_scriptsacf/input/admin_l10nacf/input/admin_print_footer_scriptsacf/input/admin_print_scripts
blocks.php
Hooks
acf/blocks/default_block_versionacf/blocks/default_block_versionacf/blocks/default_expanded_editor_button_textacf/blocks/fields_needing_wide_popoveracf/blocks/fields_to_open_in_expanded_editoracf/blocks/no_fields_assigned_messageacf/blocks/post_block_template_renderacf/blocks/pre_block_template_renderacf/blocks/prevent_edit_forms_on_rest_endpointsacf/blocks/render_capabilityacf/blocks/template_not_found_messageacf/blocks/top_toolbar_fieldsacf/blocks/top_toolbar_fieldsacf/blocks/top_toolbar_fieldsacf/blocks/wrap_frontend_innerblocksacf/blocks/wrap_frontend_innerblocksacf/pre_save_blockacf/register_block_type_argsacf_block_render_template
class-acf-options-page.php
Hooks
acf/get_options_pageacf/get_options_pagesacf/validate_options_page
class-acf-site-health.php
Hooks
acf/field_group/disable_field_settings_tabsacf/field_group/enable_field_browser
datastore.php
Hooks
acf/settings/enable_datastore
fields.php
Hooks
acf/field_group/additional_field_settings_tabsacf/get_field_typesacf/localized_field_categories
fields/FlexibleContent/Layout.php
Hooks
acf/fields/flexible_content/layout_title
fields/FlexibleContent/Render.php
Hooks
acf/fields/flexible_content/no_value_message
fields/class-acf-field-flexible-content.php
Hooks
acf/fields/flexible_content/layout_default_expanded
fields/class-acf-field-gallery.php
Hooks
attachment_fields_to_save
fields/class-acf-field-google-map.php
Hooks
acf/fields/google_map/api
fields/class-acf-field-icon_picker.php
Hooks
acf/fields/icon_picker/dashiconsacf/fields/icon_picker/tabs
fields/class-acf-field-nav-menu.php
Hooks
fields/class-acf-field-oembed.php
Hooks
acf/fields/oembed/allow_discovery
fields/class-acf-field-page_link.php
Hooks
acf/fields/page_link/queryacf/fields/page_link/result
fields/class-acf-field-post_object.php
Hooks
acf/fields/post_object/queryacf/fields/post_object/result
fields/class-acf-field-radio.php
Hooks
acf/fields/max_appended_choices
fields/class-acf-field-relationship.php
Hooks
acf/fields/relationship/queryacf/fields/relationship/result
fields/class-acf-field-select.php
Hooks
acf/fields/max_appended_choicesacf/fields/select/query
fields/class-acf-field-taxonomy.php
Hooks
acf/fields/taxonomy/queryacf/fields/taxonomy/resultacf/fields/taxonomy/wp_list_categories
fields/class-acf-field-user.php
Hooks
acf/fields/user/queryacf/fields/user/resultacf/fields/user/resultacf/fields/user/search_columns
fields/class-acf-field-wysiwyg.php
Hooks
acf/fields/wysiwyg/toolbarsacf_the_contentacf_the_editor_contentmce_buttonsmce_buttons_2mce_buttons_3mce_buttons_4media_buttonsteeny_mce_buttons
forms/WC_Order.php
Hooks
acf/input/meta_box_priority
forms/form-front.php
Functions
acf_formacf_get_formacf_get_formsacf_register_form
Hooks
acf/form/allowed_field_keysacf/form/meta_ttlacf/pre_save_postacf/pre_submit_formacf/submit_formacf/validate_form
forms/form-post.php
Hooks
acf/form-post/skip_saveacf/input/meta_box_priority
l10n.php
Hooks
acf/get_localedetermine_localeplugin_localepre_determine_locale
local-json.php
Hooks
acf/json/eof_newlineacf/json/load_pathsacf/json/save_file_nameacf/json/save_pathsacf/pre_save_json_filewp_delete_file
locations.php
Hooks
acf/location/match_ruleacf/location/rule_matchacf/location/rule_operatorsacf/location/rule_typesacf/location/rule_valuesacf/location/screenacf/location/validate_rule
locations/class-acf-location-page-template.php
Hooks
default_page_template_title
locations/class-acf-location-post-template.php
Hooks
default_page_template_title
media.php
Hooks
acf/upload_prefilter
post-types/class-acf-post-type.php
Hooks
acf/post_type/prevent_access_to_wp_functions_in_meta_box_cbacf/post_type/registration_args
post-types/class-acf-taxonomy.php
Hooks
acf/taxonomy/prevent_access_to_wp_functions_in_meta_box_cbacf/taxonomy/registration_args
post-types/class-acf-ui-options-page.php
Hooks
acf/ui_options_page/registration_args
post-types/class-scf-field-manager.php
Hooks
acf/prepare_field_for_export
rest-api/acf-rest-api-functions.php
Hooks
acf/rest/format_value_for_restacf/rest/get_field_linksacf/rest/get_field_schema
rest-api/class-acf-rest-api.php
Classes
ACF_Rest_Api
Hooks
acf/rest/get_fields
Methods
__constructinitializeis_admin_mode
rest-api/class-acf-rest-embed-links.php
Methods
initialize
revisions.php
Hooks
acf/revisions/skip_legacy_metabox_handlingacf/revisions/skip_legacy_metabox_handling
upgrades.php
Hooks
acf/update_500_fieldacf/upgrade_500acf/upgrade_500_field_groupacf/upgrade_550acf/upgrade_550_taxonomyacf/upgrade_550_taxonomy_termacf/upgrade_550_termmeta
validation.php
Hooks
acf/validate_save_postacf/validate_value
Acf Bidirectional Functions Global Functions
acf_update_bidirectional_values()
Process updating bidirectional fields.
- @since ACF 6.2
- @param array $target_item_ids The post, user or term IDs which should be updated with the origin item ID.
- @param integer|string $post_id The ACF encoded origin post, user or term ID.
- @param array $field The field being updated on the origin post, user or term ID.
- @param string|false $target_prefix The ACF prefix for a post, user or term ID required for the update_field call for this field type.
- @return void
_scf_prepare_bidirectional_update()
Prepare a side-effect-free bidirectional update plan.
- @since SCF 6.9.5 @internal
- @param array $target_item_ids Target post, user, or term IDs.
- @param integer|string $post_id Encoded origin object ID.
- @param array $field Field being updated on the origin object.
- @param string|false $target_prefix Target object prefix, or false for posts.
- @param array|null $current_values Optional current raw field values.
- @return array
_scf_collect_bidirectional_destinations()
Collect the bidirectional destinations that a field update will write.
- @since SCF 6.9.5 @internal
- @param array $field Resolved root or nested field.
- @param mixed $value Incoming value for the field.
- @param integer|string $post_id Encoded origin object ID.
- @param array|null $current Optional current values, or null to load them.
- @param boolean $resave_paginated Whether paginated repeater rows will be re-saved.
- @return array
acf_get_valid_bidirectional_target_types()
Allows third party fields to enable support as a target field type for a particular object type
- @since ACF 6.2
- @param string $object_type The object type that will be updated on the target field, such as 'term', 'user' or 'post'.
- @return array An array of valid field type names (slugs) for the target of the bidirectional field.
acf_build_bidirectional_target_current_choices()
Build the complete choices argument for rendering the select2 field for bidirectional target based on the currently selected choices
- @since ACF 6.2
- @param array $choices The currently selected choices (as an array of field keys).
- @return array
acf_build_bidirectional_relationship_field_target_args()
Build valid fields for a bidirectional relationship for select2 display
- @since ACF 6.2
- @param array $results The original results array.
- @param array $options The options provided to the select2 AJAX search.
- @return array
acf_render_bidirectional_field_settings()
Renders the field settings required for bidirectional fields
- @since ACF 6.2
- @param array $field The field object passed into field setting functions.
- @return void
acf_get_bidirectional_field_settings_instruction_text()
Returns the translated instructional text for the message field for the bidirectional field settings.
- @since ACF 6.2
- @return string The html containing the instructional message.
Acf Field Functions Global Functions
acf_get_field()
acf_get_field
- Retrieves a field for the given identifier.
- @date 17/1/19
- @since ACF 5.7.10
- @param (int|string) $id The field ID, key or name.
- @return (array|false) The field array.
acf_get_raw_field()
acf_get_raw_field
- Retrieves raw field data for the given identifier.
- @date 18/1/19
- @since ACF 5.7.10
- @param (int|string) $id The field ID, key or name.
- @return (array|false) The field array.
acf_get_field_post()
acf_get_field_post
- Retrieves the field's WP_Post object.
- @date 18/1/19
- @since ACF 5.7.10
- @param (int|string) $id The field ID, key or name.
- @return (array|false) The field array.
acf_is_field_key()
acf_is_field_key
- Returns true if the given identifier is a field key.
- @date 6/12/2013
- @since ACF 5.0.0
- @param string $id The identifier.
- @return boolean
acf_validate_field()
acf_validate_field
- Ensures the given field valid.
- @date 18/1/19
- @since ACF 5.7.10
- @param array $field The field array.
- @return array
acf_get_valid_field()
acf_get_valid_field
- Ensures the given field valid.
- @date 28/09/13
- @since ACF 5.0.0
- @param array $field The field array.
- @return array
acf_translate_field()
acf_translate_field
- Translates a field's settings.
- @date 8/03/2016
- @since ACF 5.3.2
- @param array $field The field array.
- @return array
acf_get_fields()
acf_get_fields
- Returns and array of fields for the given $parent.
- @date 30/09/13
- @since ACF 5.0.0
- @param (int|string|array) $parent The field group or field settings. Also accepts the field group ID or key.
- @return array
acf_get_raw_fields()
acf_get_raw_fields
- Returns and array of raw field data for the given parent id.
- @date 18/1/19
- @since ACF 5.7.10
- @param integer $id The field group or field id.
- @return array
acf_get_field_count()
acf_get_field_count
- Return the number of fields for the given field group.
- @date 17/10/13
- @since ACF 5.0.0
- @param array $parent The field group or field array.
- @return integer
acf_clone_field()
acf_clone_field
- Allows customization to a field when it is cloned. Used by the clone field.
- @date 8/03/2016
- @since ACF 5.3.2
- @param array $field The field being cloned.
- @param array $clone_field The clone field.
- @return array
acf_prepare_field()
acf_prepare_field
- Prepare a field for input.
- @date 20/1/19
- @since ACF 5.7.10
- @param array $field The field array.
- @return array
acf_render_fields()
acf_render_fields
- Renders an array of fields. Also loads the field's value.
- @date 8/10/13
- @since ACF 5.0.0
- @since ACF 5.6.9 Changed parameter order.
- @param array $fields An array of fields.
- @param (int|string) $post_id The post ID to load values from.
- @param string $element The wrapping element type.
- @param string $instruction The instruction render position (label|field).
- @return void
acf_render_field_wrap()
Render the wrapping element for a given field.
- @since ACF 5.0.0
- @param array $field The field array.
- @param string $element The wrapping element type.
- @param string $instruction The instruction render position (label|field).
- @param boolean $field_setting If a field setting is being rendered.
- @return void
acf_render_field()
acf_render_field
- Render the input element for a given field.
- @date 21/1/19
- @since ACF 5.7.10
- @param array $field The field array.
- @return void
acf_render_field_label()
acf_render_field_label
- Renders the field's label.
- @date 19/9/17
- @since ACF 5.6.3
- @param array $field The field array.
- @return void
acf_get_field_label()
acf_get_field_label
- Returns the field's label with appropriate required label.
- @date 4/11/2013
- @since ACF 5.0.0
- @param array $field The field array.
- @param string $context The output context (admin).
- @return string The field label in HTML format.
acf_render_field_instructions()
Renders the field's instructions.
- @since ACF 5.6.3
- @param array $field The field array.
- @param boolean $tooltip If the instructions are being rendered as a tooltip.
- @return void
acf_render_field_setting()
acf_render_field_setting
- Renders a field setting used in the admin edit screen.
- @date 21/1/19
- @since ACF 5.7.10
- @param array $field The field array.
- @param array $setting The settings field array.
- @param boolean $global Whether this setting is a global or field type specific one.
- @return void
acf_update_field()
acf_update_field
- Updates a field in the database.
- @date 21/1/19
- @since ACF 5.7.10
- @param array $field The field array.
- @param array $specific An array of specific field attributes to update.
- @return array
_acf_apply_unique_field_slug()
_acf_apply_unique_field_slug
- Allows full control over 'acf-field' slugs.
- @date 21/1/19
- @since ACF 5.7.10
- @param string $slug The post slug.
- @param integer $post_ID Post ID.
- @param string $post_status The post status.
- @param string $post_type Post type.
- @param integer $post_parent Post parent ID
- @param string $original_slug The original post slug.
acf_flush_field_cache()
acf_flush_field_cache
- Deletes all caches for this field.
- @date 22/1/19
- @since ACF 5.7.10
- @param array $field The field array.
- @return void
acf_delete_field()
acf_delete_field
- Deletes a field from the database.
- @date 21/1/19
- @since ACF 5.7.10
- @param (int|string) $id The field ID, key or name.
- @return boolean True if field was deleted.
acf_trash_field()
acf_trash_field
- Trashes a field from the database.
- @date 2/10/13
- @since ACF 5.0.0
- @param (int|string) $id The field ID, key or name.
- @return boolean True if field was trashed.
acf_untrash_field()
acf_untrash_field
- Restores a field from the trash.
- @date 2/10/13
- @since ACF 5.0.0
- @param (int|string) $id The field ID, key or name.
- @return boolean True if field was trashed.
_acf_untrash_field_post_status()
Filter callback which returns the previous post_status instead of "draft" for the "acf-field" post type.
- Prior to WordPress 5.6.0, this filter was not needed as restored posts were always assigned their original status.
- @since ACF 5.9.5
- @param string $new_status The new status of the post being restored.
- @param integer $post_id The ID of the post being restored.
- @param string $previous_status The status of the post at the point where it was trashed.
- @return string.
acf_prefix_fields()
acf_prefix_fields
- Changes the prefix for an array of fields by reference.
- @date 5/9/17
- @since ACF 5.6.0
- @param array $fields An array of fields.
- @param string $prefix The new prefix.
- @return void
acf_get_sub_field()
acf_get_sub_field
- Searches a field for sub fields matching the given selector.
- @date 21/1/19
- @since ACF 5.7.10
- @param (int|string) $id The field ID, key or name.
- @param array $field The parent field array.
- @return (array|false)
acf_search_fields()
acf_search_fields
- Searches an array of fields for one that matches the given identifier.
- @date 12/2/19
- @since ACF 5.7.11
- @param (int|string) $id The field ID, key or name.
- @param array $haystack The array of fields.
- @return (int|false)
acf_is_field()
acf_is_field
- Returns true if the given params match a field.
- @date 21/1/19
- @since ACF 5.7.10
- @param array $field The field array.
- @param mixed $id An optional identifier to search for.
- @return boolean
acf_get_field_ancestors()
acf_get_field_ancestors
- Returns an array of ancestor field ID's or keys.
- @date 22/06/2016
- @since ACF 5.3.8
- @param array $field The field array.
- @return array
acf_duplicate_fields()
acf_duplicate_fields
- Duplicate an array of fields.
- @date 16/06/2014
- @since ACF 5.0.0
- @param array $fields An array of fields.
- @param integer $parent_id The new parent ID.
- @return array
acf_duplicate_field()
acf_duplicate_field
- Duplicates a field.
- @date 16/06/2014
- @since ACF 5.0.0
- @param (int|string) $id The field ID, key or name.
- @param integer $parent_id The new parent ID.
- @return boolean True if field was duplicated.
acf_prepare_fields_for_export()
acf_prepare_fields_for_export
- Returns a modified array of fields ready for export.
- @date 11/03/2014
- @since ACF 5.0.0
- @param array $fields An array of fields.
- @return array
acf_prepare_field_for_export()
acf_prepare_field_for_export
- Returns a modified field ready for export.
- @date 11/03/2014
- @since ACF 5.0.0
- @param array $field The field array.
- @return array
acf_prepare_fields_for_import()
acf_prepare_field_for_import
- Returns a modified array of fields ready for import.
- @date 11/03/2014
- @since ACF 5.0.0
- @param array $fields An array of fields.
- @return array
acf_prepare_field_for_import()
acf_prepare_field_for_import
- Returns a modified field ready for import. Allows parent fields to modify themselves and also return sub fields.
- @date 11/03/2014
- @since ACF 5.0.0
- @param array $field The field array.
- @return array
acf_get_field_json_schema()
Retrieves the JSON schema for a field.
- @since 6.8.0
- @param string $field_type The field to get the JSON schema for.
- @return array
Acf Field Group Functions Global Functions
acf_get_field_group()
acf_get_field_group
- Retrieves a field group for the given identifier.
- @date 30/09/13
- @since ACF 5.0.0
- @param (int|string) $id The field group ID, key or name.
- @return (array|false) The field group array.
acf_get_raw_field_group()
acf_get_raw_field_group
- Retrieves raw field group data for the given identifier.
- @date 18/1/19
- @since ACF 5.7.10
- @param (int|string) $id The field ID, key or name.
- @return (array|false) The field group array.
acf_get_field_group_post()
acf_get_field_group_post
- Retrieves the field group's WP_Post object.
- @date 18/1/19
- @since ACF 5.7.10
- @param (int|string) $id The field group's ID, key or name.
- @return (array|false) The field group's array.
acf_is_field_group_key()
acf_is_field_group_key
- Returns true if the given identifier is a field group key.
- @date 6/12/2013
- @since ACF 5.0.0
- @param string $id The identifier.
- @return boolean
acf_validate_field_group()
Ensures the given field group is valid.
- @date 18/1/19
- @since ACF 5.7.10
- @param array $field_group The field group array.
- @return array
acf_get_valid_field_group()
acf_get_valid_field_group
- Ensures the given field group is valid.
- @date 28/09/13
- @since ACF 5.0.0
- @param array $field_group The field group array.
- @return array
acf_translate_field_group()
acf_translate_field_group
- Translates a field group's settings.
- @date 8/03/2016
- @since ACF 5.3.2
- @param array $field_group The field group array.
- @return array
acf_get_field_groups()
acf_get_field_groups
- Returns and array of field_groups for the given $filter.
- @date 30/09/13
- @since ACF 5.0.0
- @param array $filter An array of args to filter results by.
- @return array
acf_get_raw_field_groups()
acf_get_raw_field_groups
- Returns and array of raw field_group data.
- @date 18/1/19
- @since ACF 5.7.10
- @return array
acf_filter_field_groups()
acf_filter_field_groups
- Returns a filtered array of field groups based on the given $args.
- @date 29/11/2013
- @since ACF 5.0.0
- @param array $field_groups An array of field groups.
- @param array $args An array of location args.
- @return array
acf_get_field_group_visibility()
acf_get_field_group_visibility
- Returns true if the given field group's location rules match the given $args.
- @date 7/10/13
- @since ACF 5.0.0
- @param array $field_groups An array of field groups.
- @param array $args An array of location args.
- @return boolean
acf_update_field_group()
acf_update_field_group
- Updates a field group in the database.
- @date 21/1/19
- @since ACF 5.7.10
- @param array $field_group The field group array.
- @return array
_acf_apply_unique_field_group_slug()
_acf_apply_unique_field_group_slug
- Allows full control over 'acf-field-group' slugs.
- @date 21/1/19
- @since ACF 5.7.10
- @param string $slug The post slug.
- @param integer $post_ID Post ID.
- @param string $post_status The post status.
- @param string $post_type Post type.
- @param integer $post_parent Post parent ID
- @param string $original_slug The original post slug.
acf_flush_field_group_cache()
acf_flush_field_group_cache
- Deletes all caches for this field group.
- @date 22/1/19
- @since ACF 5.7.10
- @param array $field_group The field group array.
- @return void
acf_delete_field_group()
acf_delete_field_group
- Deletes a field group from the database.
- @date 21/1/19
- @since ACF 5.7.10
- @param (int|string) $id The field group ID, key or name.
- @return boolean True if field group was deleted.
acf_trash_field_group()
acf_trash_field_group
- Trashes a field group from the database.
- @date 2/10/13
- @since ACF 5.0.0
- @param (int|string) $id The field group ID, key or name.
- @return boolean True if field group was trashed.
acf_untrash_field_group()
acf_untrash_field_group
- Restores a field_group from the trash.
- @date 2/10/13
- @since ACF 5.0.0
- @param (int|string) $id The field_group ID, key or name.
- @return boolean True if field_group was trashed.
_acf_untrash_field_group_post_status()
Filter callback which returns the previous post_status instead of "draft" for the "acf-field-group" post type.
- Prior to WordPress 5.6.0, this filter was not needed as restored posts were always assigned their original status.
- @since ACF 5.9.5
- @param string $new_status The new status of the post being restored.
- @param integer $post_id The ID of the post being restored.
- @param string $previous_status The status of the post at the point where it was trashed.
- @return string.
acf_is_field_group()
acf_is_field_group
- Returns true if the given params match a field group.
- @date 21/1/19
- @since ACF 5.7.10
- @param array $field_group The field group array.
- @param mixed $id An optional identifier to search for.
- @return boolean
acf_duplicate_field_group()
acf_duplicate_field_group
- Duplicates a field group.
- @date 16/06/2014
- @since ACF 5.0.0
- @param (int|string) $id The field_group ID, key or name.
- @param integer $new_post_id Optional post ID to override.
- @return array The new field group.
acf_update_field_group_active_status()
Activates or deactivates a field group.
- @param integer|string $id The field_group ID, key or name.
- @param boolean $activate True if the post should be activated.
- @return boolean
acf_get_field_group_style()
acf_get_field_group_style
- Returns the CSS styles generated from field group settings.
- @date 20/10/13
- @since ACF 5.0.0
- @param array $field_group The field group array.
- @return string.
acf_get_field_group_edit_link()
acf_get_field_group_edit_link
- Checks if the current user can edit the field group and returns the edit url.
- @date 23/9/18
- @since ACF 5.7.7
- @param integer $post_id The field group ID.
- @return string
acf_prepare_field_group_for_export()
acf_prepare_field_group_for_export
- Returns a modified field group ready for export.
- @date 11/03/2014
- @since ACF 5.0.0
- @param array $field_group The field group array.
- @return array
acf_prepare_field_group_for_import()
acf_prepare_field_group_for_import
- Prepares a field group for the import process.
- @date 21/11/19
- @since ACF 5.8.8
- @param array $field_group The field group array.
- @return array
acf_import_field_group()
acf_import_field_group
- Imports a field group into the database.
- @date 11/03/2014
- @since ACF 5.0.0
- @param array $field_group The field group array.
- @return array The new field group.
acf_get_combined_field_group_settings_tabs()
Returns an array of tabs for the field group settings. We combine a list of default tabs with filtered tabs. I.E. Default tabs should be static and should not be changed by the filtered tabs.
- @since ACF 6.1
- @return array Key/value array of the default settings tabs for field group settings.
acf_field_group_has_location_type()
Checks if a field group has the provided location rule.
- @since ACF 6.2.8
- @param integer $post_id The post ID of the field group.
- @param string $location The location type to check for.
- @return boolean
acf_get_field_group_title()
Retrieves the field group title, or display title if set.
- @since ACF 6.6
- @param array|integer $field_group The field group array or ID.
- @return string The field group title.
Acf Form Functions Global Functions
acf_set_form_data()
acf_set_form_data
- Sets data about the current form.
- @date 6/10/13
- @since ACF 5.0.0
- @param string $name The store name.
- @param array $data Array of data to start the store with.
- @return ACF_Data
acf_get_form_data()
acf_get_form_data
- Gets data about the current form.
- @date 6/10/13
- @since ACF 5.0.0
- @param string $name The store name.
- @return mixed
acf_form_data()
acf_form_data
- Called within a form to set important information and render hidden inputs.
- @date 15/10/13
- @since ACF 5.0.0
- @return void
acf_save_post()
acf_save_post
- Saves the $_POST data.
- @date 15/10/13
- @since ACF 5.0.0
- @param integer|string $post_id The post id.
- @param array $values An array of values to override $_POST.
- @return boolean True if save was successful.
_acf_do_save_post()
_acf_do_save_post
- Private function hooked into 'acf/save_post' to actually save the $_POST data. This allows developers to hook in before and after ACF has actually saved the data.
- @date 11/1/19
- @since ACF 5.7.10
- @param integer|string $post_id The post id.
- @return void
Acf Helper Functions Global Functions
acf_is_empty()
Returns true if the value provided is considered "empty". Allows numbers such as 0.
- @date 6/7/16
- @since ACF 5.4.0
- @param mixed $var The value to check.
- @return boolean
acf_not_empty()
Returns true if the value provided is considered "not empty". Allows numbers such as 0.
- @date 15/7/19
- @since ACF 5.8.1
- @param mixed $var The value to check.
- @return boolean
acf_uniqid()
Returns a unique numeric based id.
- @date 9/1/19
- @since ACF 5.7.10
- @param string $prefix The id prefix. Defaults to 'acf'.
- @return string
acf_merge_attributes()
Merges together two arrays but with extra functionality to append class names.
- @date 22/1/19
- @since ACF 5.7.10
- @param array $array1 An array of attributes.
- @param array $array2 An array of attributes.
- @return array
acf_cache_key()
acf_cache_key
- Returns a filtered cache key.
- @date 25/1/19
- @since ACF 5.7.11
- @param string $key The cache key.
- @return string
acf_request_args()
acf_request_args
- Returns an array of $_REQUEST values using the provided defaults.
- @date 28/2/19
- @since ACF 5.7.13
- @param array $args An array of args.
- @return array
acf_request_arg()
Returns a single $_REQUEST arg with fallback.
- @date 23/10/20
- @since ACF 5.9.2
- @param string $key The property name.
- @param mixed $default The default value to fallback to.
- @return mixed
acf_enable_filter()
acf_enable_filter
- Enables a filter with the given name.
- @date 14/7/16
- @since ACF 5.4.0
- @param string $name The modifier name.
- @return void
acf_disable_filter()
acf_disable_filter
- Disables a filter with the given name.
- @date 14/7/16
- @since ACF 5.4.0
- @param string $name The modifier name.
- @return void
acf_is_filter_enabled()
acf_is_filter_enabled
- Returns the state of a filter for the given name.
- @date 14/7/16
- @since ACF 5.4.0
- @param string $name The modifier name.
- @return array
acf_get_filters()
acf_get_filters
- Returns an array of filters in their current state.
- @date 14/7/16
- @since ACF 5.4.0
- @return array
acf_set_filters()
acf_set_filters
- Sets an array of filter states.
- @date 14/7/16
- @since ACF 5.4.0
- @param array $filters An Array of modifiers.
- @return void
acf_disable_filters()
acf_disable_filters
- Disables all filters and returns the previous state.
- @date 14/7/16
- @since ACF 5.4.0
- @return array
acf_enable_filters()
acf_enable_filters
- Enables all or an array of specific filters and returns the previous state.
- @date 14/7/16
- @since ACF 5.4.0
- @param array $filters An Array of modifiers.
- @return array
acf_idval()
acf_idval
- Parses the provided value for an ID.
- @date 29/3/19
- @since ACF 5.7.14
- @param mixed $value A value to parse.
- @return integer
acf_maybe_idval()
acf_maybe_idval
- Checks value for potential id value.
- @date 6/4/19
- @since ACF 5.7.14
- @param mixed $value A value to parse.
- @return mixed
acf_format_numerics()
Convert any numeric strings into their equivalent numeric type. This function will work with both single values and arrays.
- @param mixed $value Either a single value or an array of values.
- @return mixed
acf_numval()
acf_numval
- Casts the provided value as eiter an int or float using a simple hack.
- @date 11/4/19
- @since ACF 5.7.14
- @param mixed $value A value to parse.
- @return (int|float)
acf_idify()
acf_idify
- Returns an id attribute friendly string.
- @date 24/12/17
- @since ACF 5.6.5
- @param string $str The string to convert.
- @return string
acf_slugify()
Returns a slug friendly string.
- @date 24/12/17
- @since ACF 5.6.5
- @param string $str The string to convert.
- @param string $glue The glue between each slug piece.
- @return string
acf_punctify()
Returns a string with correct full stop punctuation.
- @date 12/7/19
- @since ACF 5.8.2
- @param string $str The string to format.
- @return string
acf_did()
acf_did
- Returns true if ACF already did an event.
- @date 30/8/19
- @since ACF 5.8.1
- @param string $name The name of the event.
- @return boolean
acf_strlen()
Returns the length of a string that has been submitted via $_POST.
- Uses the following process:
- Unslash the string because posted values will be slashed.
- Decode special characters because wp_kses() will normalize entities.
- Treat line-breaks as a single character instead of two.
- Use mb_strlen() to accommodate special characters.
- @date 04/06/2020
- @since ACF 5.9.0
- @param string $str The string to review.
- @return integer
acf_with_default()
Returns a value with default fallback.
- @date 6/4/20
- @since ACF 5.9.0
- @param mixed $value The value.
- @param mixed $default_value The default value.
- @return mixed
acf_doing_action()
Returns the current priority of a running action.
- @date 14/07/2020
- @since ACF 5.9.0
- @param string $action The action name.
- @return integer|boolean
acf_get_current_url()
Returns the current URL.
- @date 23/01/2015
- @since ACF 5.1.5
- @return string
acf_sanitize_request_args()
Sanitizes request arguments.
- @param mixed $args The data to sanitize.
- @return array|boolean|float|integer|mixed|string
acf_sanitize_files_array()
Sanitizes file upload arrays.
- @since ACF 6.0.4
- @param array $args The file array.
- @return array
acf_sanitize_files_value_array()
Sanitizes file upload values within the array.
- This addresses nested file fields within repeaters and groups.
- @since ACF 6.0.5
- @param array $array The file upload array.
- @param string $sanitize_function Callback used to sanitize array value.
- @return array
acf_maybe_unserialize()
Maybe unserialize, but don't allow any classes.
- @since ACF 6.1
- @param string $data String to be unserialized, if serialized.
- @return mixed The unserialized, or original data.
acf_is_beta()
Check if ACF is a beta-like release.
- @since ACF 6.3
- @return boolean True if the current install version contains a dash, indicating a alpha, beta or RC release.
acf_get_version_when_first_activated()
Returns the version of ACF when it was first activated. However, if ACF was first activated prior to the introduction of the acf_first_activated_version option, this function returns false (boolean) to indicate that the version could not be determined.
- @since ACF 6.3
- @return string|boolean The (string) version of ACF when it was first activated, or false (boolean) if the version could not be determined.
Acf Hook Functions Global Functions
acf_add_filter_variations()
acf_add_filter_variations
- Registers variations for the given filter.
- @date 26/1/19
- @since ACF 5.7.11
- @param string $filter The filter name.
- @param array $variations An array variation keys.
- @param integer $index The param index to find variation values.
- @return void
acf_add_action_variations()
acf_add_action_variations
- Registers variations for the given action.
- @date 26/1/19
- @since ACF 5.7.11
- @param string $action The action name.
- @param array $variations An array variation keys.
- @param integer $index The param index to find variation values.
- @return void
_acf_apply_hook_variations()
_acf_apply_hook_variations
- Applies hook variations during apply_filters() or do_action().
- @date 25/1/19
- @since ACF 5.7.11
- @param mixed
- @return mixed
acf_add_deprecated_filter()
acf_add_deprecated_filter
- Registers a deprecated filter to run during the replacement.
- @date 25/1/19
- @since ACF 5.7.11
- @param string $deprecated The deprecated hook.
- @param string $version The version this hook was deprecated.
- @param string $replacement The replacement hook.
- @return void
acf_add_deprecated_action()
acf_add_deprecated_action
- Registers a deprecated action to run during the replacement.
- @date 25/1/19
- @since ACF 5.7.11
- @param string $deprecated The deprecated hook.
- @param string $version The version this hook was deprecated.
- @param string $replacement The replacement hook.
- @return void
_acf_apply_deprecated_hook()
Applies a deprecated filter during apply_filters() or do_action().
- @date 25/1/19
- @since ACF 5.7.11
- @param mixed
- @return mixed
Acf Input Functions Global Functions
acf_filter_attrs()
acf_filter_attrs
- Filters out empty attrs from the provided array.
- @date 11/6/19
- @since ACF 5.8.1
- @param array $attrs The array of attrs.
- @return array
acf_esc_attrs()
acf_esc_attrs
- Generated valid HTML from an array of attrs.
- @date 11/6/19
- @since ACF 5.8.1
- @param array $attrs The array of attrs.
- @return string
acf_esc_html()
Sanitizes text content and strips out disallowed HTML.
- This function emulates
wp_kses_post()with a context of "acf" for extensibility. - @since ACF 5.9.6
- @param string $string The string to be escaped
- @return string|false
_acf_kses_allowed_html()
Private callback for the "wp_kses_allowed_html" filter used to return allowed HTML for "acf" context.
- @since ACF 5.9.6
- @param array $tags An array of allowed tags.
- @param string $context The context name.
- @return array
acf_hidden_input()
- Renders the HTML of a hidden input.
- @date 3/02/2014
- @since ACF 5.0.0
- @param array $attrs The array of attrs.
- @return void echos out value.
acf_get_hidden_input()
- Returns the HTML of a hidden input.
- @date 3/02/2014
- @since ACF 5.0.0
- @param array $attrs The array of attrs.
- @return string
acf_text_input()
acf_text_input
- Renders the HTML of a text input.
- @date 3/02/2014
- @since ACF 5.0.0
- @param array $attrs The array of attrs.
- @return void echos out value.
acf_get_text_input()
acf_get_text_input
- Returns the HTML of a text input.
- @date 3/02/2014
- @since ACF 5.0.0
- @param array $attrs The array of attrs.
- @return string
acf_file_input()
acf_file_input
- Renders the HTML of a file input.
- @date 3/02/2014
- @since ACF 5.0.0
- @param array $attrs The array of attrs.
- @return void echos out value.
acf_get_file_input()
acf_get_file_input
- Returns the HTML of a file input.
- @date 3/02/2014
- @since ACF 5.0.0
- @param array $attrs The array of attrs.
- @return string
acf_textarea_input()
acf_textarea_input
- Renders the HTML of a textarea input.
- @date 3/02/2014
- @since ACF 5.0.0
- @param array $attrs The array of attrs.
- @return void echos out value.
acf_get_textarea_input()
acf_get_textarea_input
- Returns the HTML of a textarea input.
- @date 3/02/2014
- @since ACF 5.0.0
- @param array $attrs The array of attrs.
- @return string
acf_checkbox_input()
acf_checkbox_input
- Renders the HTML of a checkbox input.
- @date 3/02/2014
- @since ACF 5.0.0
- @param array $attrs The array of attrs.
- @return void echos out value.
acf_get_checkbox_input()
acf_get_checkbox_input
- Returns the HTML of a checkbox input.
- @date 3/02/2014
- @since ACF 5.0.0
- @param array $attrs The array of attrs.
- @return string
acf_radio_input()
acf_radio_input
- Renders the HTML of a radio input.
- @date 3/02/2014
- @since ACF 5.0.0
- @param array $attrs The array of attrs.
- @return void echos out value.
acf_get_radio_input()
acf_get_radio_input
- Returns the HTML of a radio input.
- @date 3/02/2014
- @since ACF 5.0.0
- @param array $attrs The array of attrs.
- @return string
acf_select_input()
acf_select_input
- Renders the HTML of a select input.
- @date 3/02/2014
- @since ACF 5.0.0
- @param array $attrs The array of attrs.
- @return void
acf_get_select_input()
acf_select_input
- Returns the HTML of a select input.
- @date 3/02/2014
- @since ACF 5.0.0
- @param array $attrs The array of attrs.
- @return string
acf_walk_select_input()
acf_walk_select_input
- Returns the HTML of a select input's choices.
- @date 27/6/17
- @since ACF 5.6.0
- @param array $choices The choices to walk through.
- @param array $values The selected choices.
- @param array $depth The current walk depth.
- @return string
acf_clean_atts()
acf_clean_atts
- See acf_filter_attrs().
- @date 3/10/17
- @since ACF 5.6.3
- @param array $attrs The array of attrs.
- @return string
acf_esc_atts()
acf_esc_atts
- See acf_esc_attrs().
- @date 27/6/17
- @since ACF 5.6.0
- @param array $attrs The array of attrs.
- @return string
acf_esc_attr()
acf_esc_attr
- @date 13/6/19
- @since ACF 5.8.1
- @deprecated 5.6.0 @see acf_esc_attrs().
- @param array $attrs The array of attrs.
- @return string
acf_esc_attr_e()
acf_esc_attr_e
- See acf_esc_attrs().
- @date 13/6/19
- @since ACF 5.8.1
- @deprecated 5.6.0
- @param array $attrs The array of attrs.
acf_esc_atts_e()
acf_esc_atts_e
- See acf_esc_attrs().
- @date 13/6/19
- @since ACF 5.8.1
- @deprecated 5.6.0
- @param array $attrs The array of attrs.
Acf Internal Post Type Functions Global Functions
acf_get_internal_post_type_instance()
Gets an instance of an ACF_Internal_Post_Type.
- @param string $post_type The ACF internal post type to get the instance for.
- @return ACF_Internal_Post_Type|boolean The internal post type class instance, or false on failure.
acf_get_internal_post_type()
Get an ACF CPT object as an array
- @param integer $id The post ID being queried.
- @param string $post_type The post type being queried.
- @return array|false The post type object.
acf_get_raw_internal_post_type()
Retrieves raw internal post type data for the given identifier.
- @since ACF 6.1
- @param integer|string $id The post ID.
- @param string $post_type The post type name.
- @return array|false The internal post type array.
acf_get_internal_post_type_post()
Gets a post object from an ACF internal post type.
- @since ACF 6.1
- @param integer|string $id The post ID, key, or name.
- @param string $post_type The post type name.
- @return object|boolean The post object, or false on failure.
acf_is_internal_post_type_key()
Returns true if the given identifier is a ACF internal post type key.
- @since ACF 6.1
- @param string $id The identifier.
- @param string $post_type The ACF post type the key is for.
- @return boolean
acf_validate_internal_post_type()
Validates an ACF internal post type.
- @since ACF 6.1
- @param array $internal_post_type The internal post type array.
- @param string $post_type_name The post type name.
- @return array|boolean
acf_translate_internal_post_type()
Translates the settings for an ACF internal post type.
- @since ACF 6.1
- @param array $internal_post_type The ACF post array.
- @param string $post_type The post type name.
- @return array
acf_get_internal_post_type_posts()
Returns and array of ACF posts for the given $filter.
- @since ACF 6.1
- @param string $post_type The ACF post type to get posts for.
- @param array $filter An array of args to filter results by.
- @return array
acf_get_raw_internal_post_type_posts()
Returns an array of raw/unvalidated ACF post data.
- @since ACF 6.1
- @param string $post_type The ACF post type to get post data for.
- @return array
acf_filter_internal_post_type_posts()
Returns a filtered array of ACF posts based on the given $args.
- @since ACF 6.1
- @param array $posts An array of ACF posts.
- @param array $args An array of args to filter by.
- @param string $post_type The ACF post type of the posts being filtered.
- @return array
acf_update_internal_post_type()
Updates a internal post type in the database.
- @since ACF 6.1
- @param array $internal_post_type Array of data to be saved.
- @param string $post_type_name The internal post type being updated.
- @return array
acf_flush_internal_post_type_cache()
Deletes all caches for the provided ACF post.
- @since ACF 6.1
- @param array $post The ACF post array.
- @param string $post_type The ACF post type the cache is being cleared for.
- @return void
acf_delete_internal_post_type()
Deletes an internal post type from the database.
- @since ACF 6.1
- @param integer|string $id The internal post type ID, key or name.
- @param string $post_type_name The post type to be deleted.
- @return boolean True if field group was deleted.
acf_trash_internal_post_type()
Trashes an internal post type.
- @since ACF 6.1
- @param integer|string $id The internal post type ID, key, or name.
- @param string $post_type_name The post type being trashed.
- @return boolean True if post was trashed.
acf_untrash_internal_post_type()
Restores an ACF post from the trash.
- @since ACF 6.1
- @param integer|string $id The internal post type ID, key, or name.
- @param string $post_type_name The post type being untrashed.
- @return boolean True if post was untrashed.
acf_is_internal_post_type()
Returns true if the given params match an ACF post.
- @since ACF 6.1
- @param array $post The ACF post array.
- @param string $post_type The ACF post type.
- @return boolean
acf_duplicate_internal_post_type()
Duplicates an ACF post.
- @since ACF 6.1
- @param integer|string $id The field_group ID, key or name.
- @param integer $new_post_id Optional ID to override.
- @param string $post_type The post type of the post being duplicated.
- @return array|boolean The new ACF post, or false on failure.
acf_update_internal_post_type_active_status()
Activates or deactivates an ACF post.
- @param integer|string $id The field_group ID, key or name.
- @param boolean $activate True if the post should be activated.
- @param string $post_type The post type being activated/deactivated.
- @return boolean
acf_get_internal_post_type_edit_link()
Checks if the current user can edit the field group and returns the edit url.
- @since ACF 6.1
- @param integer $post_id The ACF post ID.
- @param string $post_type The ACF post type to get the edit link for.
- @return string
acf_prepare_internal_post_type_for_export()
Returns a modified field group ready for export.
- @since ACF 6.1
- @param array $post The ACF post array.
- @param string $post_type The post type of the ACF post being exported.
- @return array
acf_export_internal_post_type_as_php()
Exports an ACF post as PHP.
- @since ACF 6.1
- @param array $post The ACF post array.
- @param string $post_type The post type of the ACF post being exported.
- @return string|boolean
acf_prepare_internal_post_type_for_import()
Prepares an ACF post for the import process.
- @since ACF 6.1
- @param array $post The ACF post array.
- @param string $post_type The post type of the ACF post being imported.
- @return array
acf_import_internal_post_type()
Imports an ACF post into the database.
- @since ACF 6.1
- @param array $post The ACF post array.
- @param string $post_type The post type of the ACF post being imported.
- @return array The imported post.
acf_determine_internal_post_type()
Tries to determine the ACF post type for the provided key.
- @param string $key The key to check.
- @return string|boolean
acf_is_valid_internal_post_type_key()
Check if the provided key is an identifiable ACF post type.
- @since ACF 6.2.8
- @param string $key The key to check.
- @return boolean
acf_internal_post_object_contains_valid_key()
Check if the provided post type object contains a valid internal post type key.
- @since ACF 6.2.8
- @param array $internal_post_type The post type object array to check it's key.
- @return boolean
acf_get_combined_post_type_settings_tabs()
Returns an array of tabs for the post type advanced settings.
- @since ACF 6.1
- @return array
acf_get_combined_taxonomy_settings_tabs()
Returns an array of tabs for the taxonomy advanced settings.
- @since ACF 6.1
- @return array
acf_get_combined_options_page_settings_tabs()
Returns an array of tabs for the options page advanced settings
- @since ACF 6.2
- @return array
acf_get_post_type_from_screen_value()
Converts an _acf_screen or hook value into a post type.
- @since ACF 6.1
- @param string $screen The ACF screen being viewed.
- @return string The post type matching the screen or hook value.
acf_validate_internal_post_type_values()
Calls the ajax validator for a post type
- @since ACF 6.1
- @param string $post_type The post type being validated.
- @return mixed
acf_add_internal_post_type_validation_error()
Adds a validation error for ACF internal post types.
- @since ACF 6.1
- @param string $name The name of the input.
- @param string $message An optional error message to display.
- @param string $post_type Optional post type the error message is for.
- @return void
acf_get_post_type_from_request_args()
Gets an ACF post type from request args and verifies nonce based on action.
- @since ACF 6.1.5
- @param string $action The action being performed.
- @return array|boolean
acf_get_taxonomy_from_request_args()
Gets an ACF taxonomy from request args and verifies nonce based on action.
- @since ACF 6.1.5
- @param string $action The action being performed.
- @return array|boolean
acf_get_ui_options_page_from_request_args()
Gets an ACF options page from request args and verifies nonce based on action.
- @since ACF 6.2
- @param string $action The action being performed.
- @return array|boolean
Acf Meta Functions Global Functions
acf_get_meta()
Returns an array of "ACF only" meta for the given post_id.
- @date 9/10/18
- @since ACF 5.8.0
- @param mixed $post_id The post_id for this data.
- @return array
acf_get_option_meta()
acf_get_option_meta
- Returns an array of meta for the given wp_option name prefix in the same format as get_post_meta().
- @date 9/10/18
- @since ACF 5.8.0
- @param string $prefix The wp_option name prefix.
- @return array
acf_get_metadata()
Retrieves specific metadata from the database.
- @date 16/10/2015
- @since ACF 5.2.3
- @param integer|string $post_id The post id.
- @param string $name The meta name.
- @param boolean $hidden If the meta is hidden (starts with an underscore).
- @return mixed
acf_update_metadata()
Updates metadata in the database.
- @date 16/10/2015
- @since ACF 5.2.3
- @param integer|string $post_id The post id.
- @param string $name The meta name.
- @param mixed $value The meta value.
- @param boolean $hidden If the meta is hidden (starts with an underscore).
- @return integer|boolean Meta ID if the key didn't exist, true on successful update, false on failure.
acf_delete_metadata()
Deletes metadata from the database.
- @date 16/10/2015
- @since ACF 5.2.3
- @param integer|string $post_id The post id.
- @param string $name The meta name.
- @param boolean $hidden If the meta is hidden (starts with an underscore).
- @return boolean
acf_copy_metadata()
Copies meta from one post to another. Useful for saving and restoring revisions.
- @since ACF 5.3.8
- @param integer|string $from_post_id The post id to copy from.
- @param integer|string $to_post_id The post id to paste to.
- @return void
acf_copy_postmeta()
acf_copy_postmeta
- Copies meta from one post to another. Useful for saving and restoring revisions.
- @date 25/06/2016
- @since ACF 5.3.8
- @deprecated 5.7.11
- @param integer $from_post_id The post id to copy from.
- @param integer $to_post_id The post id to paste to.
- @return void
acf_get_meta_field()
acf_get_meta_field
- Returns a field using the provided $id and $post_id parameters. Looks for a reference to help loading the correct field via name.
- @date 21/1/19
- @since ACF 5.7.10
- @param string $key The meta name (field name).
- @param (int|string) $post_id The post_id where this field's value is saved.
- @return (array|false) The field array.
acf_get_metaref()
acf_get_metaref
- Retrieves reference metadata from the database.
- @date 16/10/2015
- @since ACF 5.2.3
- @param (int|string) $post_id The post id.
- @param string type The reference type (fields|groups).
- @param string $name An optional specific name
- @return mixed
acf_update_metaref()
acf_update_metaref
- Updates reference metadata in the database.
- @date 16/10/2015
- @since ACF 5.2.3
- @param (int|string) $post_id The post id.
- @param string type The reference type (fields|groups).
- @param array $references An array of references.
- @return (int|bool) Meta ID if the key didn't exist, true on successful update, false on failure.
acf_get_meta_instance()
Retrieves an ACF meta instance for the provided meta type.
- @since 6.5
- @param string $type The meta type as decoded from the post ID.
- @return object|null
acf_get_metadata_by_field()
Gets metadata from the database.
- @since 6.5
- @param integer|string $post_id The post id.
- @param array $field The field array.
- @param boolean $hidden True if we should return the reference key.
- @return mixed
acf_update_metadata_by_field()
Updates metadata in the database.
- @since 6.5
- @param integer|string $post_id The post id.
- @param array $field The field array.
- @param mixed $value The meta value.
- @param boolean $hidden True if we should update the reference key.
- @return integer|boolean Meta ID if the key didn't exist, true on successful update, false on failure.
acf_delete_metadata_by_field()
Deletes metadata from the database.
- @since 6.5
- @param integer|string $post_id The post id.
- @param array $field The field array.
- @param boolean $hidden True if we should update the reference key.
- @return boolean
Acf Post Functions Global Functions
acf_get_post_templates()
Returns available templates for each post type.
- @date 29/8/17
- @since ACF 5.6.2
- @return array
Acf Post Type Functions Global Functions
acf_get_post_type()
Get an ACF CPT as an array
- @param integer|string $id The post ID being queried.
- @return array|false The post type object.
acf_get_raw_post_type()
Retrieves a raw ACF CPT.
- @since ACF 6.1
- @param integer|string $id The post ID.
- @return array|false The internal post type array.
acf_get_post_type_post()
Gets a post object for an ACF CPT.
- @since ACF 6.1
- @param integer|string $id The post ID, key, or name.
- @return object|boolean The post object, or false on failure.
acf_is_post_type_key()
Returns true if the given identifier is an ACF CPT key.
- @since ACF 6.1
- @param string $id The identifier.
- @return boolean
acf_validate_post_type()
Validates an ACF CPT.
- @since ACF 6.1
- @param array $post_type The ACF post type array.
- @return array|boolean
acf_translate_post_type()
Translates the settings for an ACF internal post type.
- @since ACF 6.1
- @param array $post_type The ACF post type array.
- @return array
acf_get_acf_post_types()
Returns and array of ACF post types for the given $filter.
- @since ACF 6.1
- @param array $filter An array of args to filter results by.
- @return array
acf_get_raw_post_types()
Returns an array of raw ACF post types.
- @since ACF 6.1
- @return array
acf_filter_post_types()
Returns a filtered array of ACF post types based on the given $args.
- @since ACF 6.1
- @param array $post_types An array of ACF posts.
- @param array $args An array of args to filter by.
- @return array
acf_update_post_type()
Updates an ACF post type in the database.
- @since ACF 6.1
- @param array $post_type The main ACF post type array.
- @return array
acf_flush_post_type_cache()
Deletes all caches for the provided ACF post type.
- @since ACF 6.1
- @param array $post_type The ACF post type array.
- @return void
acf_delete_post_type()
Deletes an ACF post type from the database.
- @since ACF 6.1
- @param integer|string $id The ACF post type ID, key or name.
- @return boolean True if post type was deleted.
acf_trash_post_type()
Trashes an ACF post type.
- @since ACF 6.1
- @param integer|string $id The post type ID, key, or name.
- @return boolean True if post was trashed.
acf_untrash_post_type()
Restores an ACF post type from the trash.
- @since ACF 6.1
- @param integer|string $id The post type ID, key, or name.
- @return boolean True if post was untrashed.
acf_is_post_type()
Returns true if the given params match an ACF post type.
- @since ACF 6.1
- @param array $post_type The ACF post type array.
- @return boolean
acf_duplicate_post_type()
Duplicates an ACF post type.
- @since ACF 6.1
- @param integer|string $id The ACF post type ID, key or name.
- @param integer $new_post_id Optional ID to override.
- @return array|boolean The new ACF post type, or false on failure.
acf_update_post_type_active_status()
Activates or deactivates an ACF post type.
- @param integer|string $id The ACF post type ID, key or name.
- @param boolean $activate True if the post type should be activated.
- @return boolean
acf_get_post_type_edit_link()
Checks if the current user can edit the post type and returns the edit url.
- @since ACF 6.1
- @param integer $post_id The ACF post type ID.
- @return string
acf_prepare_post_type_for_export()
Returns a modified ACF post type ready for export.
- @since ACF 6.1
- @param array $post_type The ACF post type array.
- @return array
acf_export_post_type_as_php()
Exports an ACF post type as PHP.
- @since ACF 6.1
- @param array $post_type The ACF post type array.
- @return string|boolean
acf_prepare_post_type_for_import()
Prepares an ACF post type for the import process.
- @since ACF 6.1
- @param array $post_type The ACF post type array.
- @return array
acf_import_post_type()
Imports an ACF post type into the database.
- @since ACF 6.1
- @param array $post_type The ACF post type array.
- @return array The imported post type.
acf_export_enter_title_here()
Exports the "Enter Title Here" text for the provided ACF post types.
- @since ACF 6.2.1
- @param array $post_types The post types being exported.
- @return string
Acf Taxonomy Functions Global Functions
acf_get_taxonomy()
Get an ACF taxonomy as an array
- @param integer|string $id The post ID being queried.
- @return array|false The taxonomy object.
acf_get_raw_taxonomy()
Retrieves a raw ACF taxonomy.
- @since ACF 6.1
- @param integer|string $id The post ID.
- @return array|false The taxonomy array.
acf_get_taxonomy_post()
Gets a post object for an ACF taxonomy.
- @since ACF 6.1
- @param integer|string $id The post ID, key, or name.
- @return object|boolean The post object, or false on failure.
acf_is_taxonomy_key()
Returns true if the given identifier is an ACF taxonomy key.
- @since ACF 6.1
- @param string $id The identifier.
- @return boolean
acf_validate_taxonomy()
Validates an ACF taxonomy.
- @since ACF 6.1
- @param array $taxonomy The ACF taxonomy array.
- @return array|boolean
acf_translate_taxonomy()
Translates the settings for an ACF taxonomy.
- @since ACF 6.1
- @param array $taxonomy The ACF taxonomy array.
- @return array
acf_get_acf_taxonomies()
Returns an array of ACF taxonomies for the given $filter.
- @since ACF 6.1
- @param array $filter An array of args to filter results by.
- @return array
acf_get_raw_taxonomies()
Returns an array of raw ACF taxonomies.
- @since ACF 6.1
- @return array
acf_filter_taxonomies()
Returns a filtered array of ACF taxonomies based on the given $args.
- @since ACF 6.1
- @param array $taxonomies An array of ACF taxonomies.
- @param array $args An array of args to filter by.
- @return array
acf_update_taxonomy()
Updates an ACF taxonomy in the database.
- @since ACF 6.1
- @param array $taxonomy The main ACF taxonomy array.
- @return array
acf_flush_taxonomy_cache()
Deletes all caches for the provided ACF taxonomy.
- @since ACF 6.1
- @param array $taxonomy The ACF taxonomy array.
- @return void
acf_delete_taxonomy()
Deletes an ACF taxonomy from the database.
- @since ACF 6.1
- @param integer|string $id The ACF taxonomy ID, key or name.
- @return boolean True if taxonomy was deleted.
acf_trash_taxonomy()
Trashes an ACF taxonomy.
- @since ACF 6.1
- @param integer|string $id The taxonomy ID, key, or name.
- @return boolean True if taxonomy was trashed.
acf_untrash_taxonomy()
Restores an ACF taxonomy from the trash.
- @since ACF 6.1
- @param integer|string $id The taxonomy ID, key, or name.
- @return boolean True if taxonomy was untrashed.
acf_is_taxonomy()
Returns true if the given params match an ACF taxonomy.
- @since ACF 6.1
- @param array $taxonomy The ACF taxonomy array.
- @return boolean
acf_duplicate_taxonomy()
Duplicates an ACF taxonomy.
- @since ACF 6.1
- @param integer|string $id The ACF taxonomy ID, key or name.
- @param integer $new_post_id Optional ID to override.
- @return array|boolean The new ACF taxonomy, or false on failure.
acf_update_taxonomy_active_status()
Activates or deactivates an ACF taxonomy.
- @param integer|string $id The ACF taxonomy ID, key or name.
- @param boolean $activate True if the taxonomy should be activated.
- @return boolean
acf_get_taxonomy_edit_link()
Checks if the current user can edit the taxonomy and returns the edit url.
- @since ACF 6.1
- @param integer $post_id The ACF taxonomy ID.
- @return string
acf_prepare_taxonomy_for_export()
Returns a modified ACF taxonomy ready for export.
- @since ACF 6.1
- @param array $taxonomy The ACF taxonomy array.
- @return array
acf_export_taxonomy_as_php()
Exports an ACF taxonomy as PHP.
- @since ACF 6.1
- @param array $taxonomy The ACF taxonomy array.
- @return string|boolean
acf_prepare_taxonomy_for_import()
Prepares an ACF taxonomy for the import process.
- @since ACF 6.1
- @param array $taxonomy The ACF taxonomy array.
- @return array
acf_import_taxonomy()
Imports an ACF taxonomy into the database.
- @since ACF 6.1
- @param array $taxonomy The ACF taxonomy array.
- @return array The imported taxonomy.
Acf User Functions Global Functions
acf_get_users()
acf_get_users
- Similar to the get_users() function but with extra functionality.
- @date 9/1/19
- @since ACF 5.7.10
- @param array $args The query args.
- @return array
acf_get_user_result()
acf_get_user_result
- Returns a result containing "id" and "text" for the given user.
- @date 21/5/19
- @since ACF 5.8.1
- @param WP_User $user The user object.
- @return array
acf_get_user_role_labels()
acf_get_user_role_labels
- Returns an array of user roles in the format "name => label".
- @date 20/5/19
- @since ACF 5.8.1
- @param array $roles A specific array of roles.
- @return array
acf_allow_unfiltered_html()
Returns true if the current user is allowed to save unfiltered HTML.
- @since ACF 5.7.10
- @return boolean
Acf Utility Functions Global Functions
acf_new_instance()
acf_new_instance
- Creates a new instance of the given class and stores it in the instances data store.
- @date 9/1/19
- @since ACF 5.7.10
- @param string $class The class name.
- @return object The instance.
acf_get_instance()
Returns an instance for the given class.
- @date 9/1/19
- @since ACF 5.7.10
- @param string $class The class name.
- @return object The instance.
acf_register_store()
acf_register_store
- Registers a data store.
- @date 9/1/19
- @since ACF 5.7.10
- @param string $name The store name.
- @param array $data Array of data to start the store with.
- @return ACF_Data
acf_get_store()
acf_get_store
- Returns a data store.
- @date 9/1/19
- @since ACF 5.7.10
- @param string $name The store name.
- @return ACF_Data
acf_switch_stores()
acf_switch_stores
- Triggered when switching between sites on a multisite installation.
- @date 13/2/19
- @since ACF 5.7.11
- @param integer $site_id New blog ID.
- @param int prev_blog_id Prev blog ID.
- @return void
acf_get_path()
acf_get_path
- Returns the plugin path to a specified file.
- @date 28/9/13
- @since ACF 5.0.0
- @param string $filename The specified file.
- @return string
acf_get_url()
acf_get_url
- Returns the plugin url to a specified file. This function also defines the ACF_URL constant.
- @date 12/12/17
- @since ACF 5.6.8
- @param string $filename The specified file.
- @return string
acf_include()
Includes a file within the ACF plugin.
- @date 10/3/14
- @since ACF 5.0.0
- @param string $filename The specified file.
- @return void
Acf Value Functions Global Functions
acf_get_reference()
acf_get_reference
- Retrieves the field key for a given field name and post_id.
- @date 26/1/18
- @since ACF 5.6.5
- @param string $field_name The name of the field. eg 'sub_heading'.
- @param mixed $post_id The post_id of which the value is saved against.
- @return string The field key.
acf_get_value()
Retrieves the value for a given field and post_id.
- @date 28/09/13
- @since ACF 5.0.0
- @param integer|string $post_id The post id.
- @param array $field The field array.
- @return mixed
acf_format_value()
Returns a formatted version of the provided value.
- @since ACF 5.0.0
- @param mixed $value The field value.
- @param integer|string $post_id The post id.
- @param array $field The field array.
- @param boolean $escape_html Ask the field for a HTML safe version of it's output.
- @return mixed
acf_update_value()
acf_update_value
- Updates the value for a given field and post_id.
- @date 28/09/13
- @since ACF 5.0.0
- @param mixed $value The new value.
- @param (int|string) $post_id The post id.
- @param array $field The field array.
- @return boolean
acf_update_values()
acf_update_values
- Updates an array of values.
- @date 26/2/19
- @since ACF 5.7.13
- @param array values The array of values.
- @param (int|string) $post_id The post id.
- @return void
acf_flush_value_cache()
acf_flush_value_cache
- Deletes all cached data for this value.
- @date 22/1/19
- @since ACF 5.7.10
- @param (int|string) $post_id The post id.
- @param string $field_name The field name.
- @return void
acf_delete_value()
acf_delete_value
- Deletes the value for a given field and post_id.
- @date 28/09/13
- @since ACF 5.0.0
- @param (int|string) $post_id The post id.
- @param array $field The field array.
- @return boolean
acf_preview_value()
acf_preview_value
- Return a human friendly 'preview' for a given field value.
- @date 28/09/13
- @since ACF 5.0.0
- @param mixed $value The new value.
- @param (int|string) $post_id The post id.
- @param array $field The field array.
- @return boolean
acf_log_invalid_field_notice()
Potentially log an error if a field doesn't exist when we expect it to.
- @param array $field An array representing the field that a value was requested for.
- @param string $function The function that noticed the problem.
- @return void
Acf Wp Functions Global Functions
acf_get_object_type()
Returns a WordPress object type.
- @date 1/4/20
- @since ACF 5.9.0
- @param string $object_type The object type (post, term, user, etc).
- @param string $object_subtype Optional object subtype (post type, taxonomy).
- @return object
acf_decode_post_id()
Decodes a post_id value such as 1 or "user_1" into an array containing the type and ID.
- @date 25/1/19
- @since ACF 5.7.11
- @param (int|string) $post_id The post id.
- @return array
acf_get_object_type_rest_base()
Determine the REST base for a post type or taxonomy object. Note that this is not intended for use with term or post objects but is, instead, to be used with the underlying WP_Post_Type and WP_Taxonomy instances.
- @param WP_Post_Type|WP_Taxonomy $type_object
- @return string|null
acf_get_object_id()
Extract the ID of a given object/array. This supports all expected types handled by our update_fields() and load_fields() callbacks.
- @param WP_Post|WP_User|WP_Term|WP_Comment|array $object
- @return integer|mixed|null
Assets Global Functions
acf_localize_text()
Appends an array of i18n data for localization.
- @date 13/4/18
- @since ACF 5.6.9
- @param array $text An array of text for i18n.
- @return void
acf_localize_data()
Appends an array of l10n data for localization.
- @date 13/4/18
- @since ACF 5.6.9
- @param array $data An array of data for l10n.
- @return void
acf_enqueue_script()
Enqueues a script with support for supplemental inline scripts.
- @date 27/4/20
- @since ACF 5.9.0
- @param string $name The script name.
- @return void
acf_enqueue_scripts()
Enqueues the input scripts required for fields.
- @date 13/4/18
- @since ACF 5.6.9
- @param array $args See ACF_Assets::enqueue_scripts() for a list of args.
- @return void
acf_enqueue_uploader()
Enqueues the WP media uploader scripts and styles.
- @date 27/10/2014
- @since ACF 5.0.9
- @return void
Blocks Global Functions
acf_add_block_namespace()
Prefix block names for SCF blocks registered through block.json
- @since ACF 6.0.0
- @param array $metadata The block metadata array.
- @return array The original array with a prefixed block name if it's an ACF block.
acf_handle_json_block_registration()
Handle an SCF block registered through block.json
- @since ACF 6.0.0
- @param array $settings The compiled block settings.
- @param array $metadata The raw json metadata.
- @return array Block registration settings with ACF required additions.
acf_is_acf_block_json()
Check if a block.json block is an SCF block.
- @since ACF 6.0.0
- @param array $metadata The raw block metadata array.
- @return boolean
acf_block_json_process_fields()
Recursively ensures every field in a set of block-inlined fields has a key,
generating field_{block_slug}_{parent_path}_{name} for any that don't.
- @since ACF 6.8.1
- @param array $fields The fields to process.
- @param string $block_slug The sanitized block slug used to build keys.
- @param string $block_name The original block name (used for error messages).
- @param string $parent_path Internal. Underscore-joined ancestor names for the current nesting level.
- @return array The processed fields, with keys filled in and invalid entries removed.
acf_register_block_field_group_from_fields()
Registers a local field group for a block from an inline fields array,
as used by acf.fields in block.json and fields in acf_register_block_type().
- @since ACF 6.8.1
- @param string $block_name The full block name (e.g. 'acf/my-block').
- @param string $block_title The block's display title, used in the default group title.
- @param array $fields The fields defined inline on the block.
- @param string $field_group_title Optional. Overrides the auto-generated "Block: {title}" group title.
- @return boolean True if the field group was registered, false otherwise.
acf_register_block_type()
Registers a block type.
- @date 18/2/19
- @since ACF 5.8.0
- @param array $block The block settings.
- @return (array|false)
acf_register_block()
See acf_register_block_type().
- @date 18/2/19
- @since ACF 5.7.12
- @param array $block The block settings.
- @return (array|false)
acf_has_block_type()
Returns true if a block type exists for the given name.
- @since ACF 5.7.12
- @param string $name The block type name.
- @return boolean
acf_get_block_types()
Returns an array of all registered block types.
- @since ACF 5.7.12
- @return array
acf_get_block_type()
Returns a block type for the given name.
- @since ACF 5.7.12
- @param string $name The block type name.
- @return (array|null)
acf_remove_block_type()
Removes a block type for the given name.
- @since ACF 5.7.12
- @param string $name The block type name.
- @return void
acf_get_block_type_default_attributes()
Returns an array of default attribute settings for a block type.
- @date 19/11/18
- @since ACF 5.8.0
- @param array $block_type A block configuration array.
- @return array
acf_validate_block_type()
Validates a block type ensuring all settings exist.
- @since ACF 5.8.0
- @param array $block The block settings.
- @return array
acf_prepare_block()
Prepares a block for use in render_callback by merging in all settings and attributes.
- @since ACF 5.8.0
- @param array $block The block props.
- @return array|boolean
acf_add_back_compat_attributes()
Add backwards compatible attribute values.
- @since ACF 6.0.0
- @param array $block The original block.
- @return array Modified block array with backwards compatibility attributes.
acf_get_block_back_compat_attribute_key_array()
Get back compat new values and old values.
- @since ACF 6.0.0
- @return array back compat key array.
acf_render_block_callback()
The render callback for all ACF blocks.
- @date 28/10/20
- @since ACF 5.9.2
- @param array $attributes The block attributes.
- @param string $content The block content.
- @param WP_Block $wp_block The block instance (since WP 5.5).
- @return string The block HTML.
acf_rendered_block()
Returns the rendered block HTML.
- @date 28/2/19
- @since ACF 5.7.13
- @param array $attributes The block attributes.
- @param string $content The block content.
- @param boolean $is_preview Whether or not the block is being rendered for editing preview.
- @param integer $post_id The current post being edited or viewed.
- @param WP_Block $wp_block The block instance (since WP 5.5).
- @param array $context The block context array.
- @param boolean $is_ajax_render Whether or not this is an ACF AJAX render.
- @return string The block HTML.
acf_rendered_block_v3()
Returns the rendered block HTML for v3 blocks.
- @date 21/1/26
- @since ACF 6.8
- @param array $attributes The block attributes.
- @param string $content The block content.
- @param boolean $is_preview Whether or not the block is being rendered for editing preview.
- @param integer $post_id The current post being edited or viewed.
- @param WP_Block $wp_block The block instance (since WP 5.5).
- @param array $context The block context array.
- @return string The block HTML.
acf_replace_inner_blocks_in_block_content()
Replaces InnerBlocks strings in a block with the inner block content.
- @since ACF 6.8
- @param string $content The block content.
- @param string $html The block html.
- @return string
acf_render_block()
Renders the block HTML.
- @since ACF 5.7.12
- @param array $attributes The block attributes.
- @param string $content The block content.
- @param boolean $is_preview Whether or not the block is being rendered for editing preview.
- @param integer $post_id The current post being edited or viewed.
- @param WP_Block $wp_block The block instance (since WP 5.5).
- @param array $context The block context array.
- @return void|string
scf_path_has_stream_wrapper()
Checks if a path uses a PHP stream wrapper, such as phar:// or php://.
- @since 6.9.3
- @param string $path The path to check.
- @return boolean True if the path begins with a stream wrapper.
acf_block_render_template()
Locate and include an ACF block's template.
- @since ACF 6.0.4
- @param array $block The block props.
- @param string $content The block content.
- @param boolean $is_preview Whether this is a preview render.
- @param int $post_id The post ID this block is saved to.
- @param object $wp_block The block instance object.
- @param array $context The block context array.
acf_get_block_fields()
Returns an array of all fields for the given block.
- @date 24/10/18
- @since ACF 5.8.0
- @param array $block The block props.
- @return array
acf_enqueue_block_assets()
Enqueues and localizes block scripts and styles.
- @since ACF 5.7.13
- @return void
acf_enqueue_in_iframe_styles()
Enqueues scripts and styles to load inside the block editor iframe. This allows us to do things like style contenteditable, and other inline editing elements.
- @since ACF 6.7
acf_enqueue_block_type_assets()
Enqueues scripts and styles for a specific block type.
- @since ACF 5.7.13
- @param array $block_type The block type settings.
- @return void
acf_ajax_fetch_block()
Handles the ajax request for block data.
- @since ACF 5.7.13
- @return void
acf_get_empty_block_form_html()
Render the empty block form for when a block has no fields assigned.
- @since ACF 6.0.0
- @param string $block_name The block name current being rendered.
- @return string The html that makes up a block form with no fields.
acf_parse_save_blocks()
Parse content that may contain HTML block comments and saves ACF block meta.
- @since ACF 5.7.13
- @param string $text Content that may contain HTML block comments.
- @return string
acf_parse_save_blocks_callback()
Callback used in preg_replace to modify ACF Block comment.
- @since ACF 5.7.13
- @param array $matches The preg matches.
- @return string
acf_get_block_id()
Return or generate a block ID.
- @since ACF 6.0.0
- @param array $attributes A block attributes array.
- @param array $context The block context array, defaults to an empty array.
- @param boolean $force If we should generate a new block ID even if one exists.
- @return string A block ID.
acf_ensure_block_id_prefix()
Ensure a block ID always has a block_ prefix for post meta internals.
- @since ACF 6.0.0
- @param string $block_id A possibly non-prefixed block ID.
- @return string A prefixed block ID.
acf_serialize_block_attributes()
This directly copied from the WordPress core serialize_block_attributes() function.
- We need this in order to make sure that block attributes are stored in a way that is consistent with how Gutenberg sends them over from JS, and so that things like wp_kses() work as expected. Copied from core to get around a bug that was fixed in 5.8.1 or on the off chance that folks are still using WP 5.3 or below.
- TODO: Remove this when we refactor
acf_parse_save_blocks_callback()to useserialize_block(), or when we're confident that folks aren't using WP versions prior to 5.8. - @since ACF 5.12
- @param array $block_attributes Attributes object.
- @return string Serialized attributes.
acf_get_block_validation_state()
Handle validating a block's fields and return the validity, and any errors.
- This function can use values loaded into Local Meta, which means they have to be converted back to the data format before they can be validated.
- @since ACF 6.3
- @param array $block An array of the block's data attribute.
- @param boolean $using_defaults True if the block is currently being generated with default values. Default false.
- @param boolean $use_post_data True if we should validate the POSTed data rather than local meta values. Default false.
- @param boolean $on_load True if we're validating as part of a render. This is essentially the same as a first load. Default false.
- @return array An array containing a valid boolean, and an errors array.
acf_validate_block_from_post_data()
Handle the specific validation for a block from POSTed values.
- @since ACF 6.3.1
- @param array $block The block object containing the POSTed values and other block data.
- @return array|boolean An array containing the validation errors, or false if there are no errors.
acf_validate_block_from_local_meta()
Handle the specific validation for a block from local meta.
- This function uses the values loaded into Local Meta, which means they have to be converted back to the data format because they can be validated.
- @since ACF 6.3.1
- @param string $block_id The block ID.
- @param array $field_objects The field objects in local meta to be validated.
- @param boolean $using_defaults True if this is the first load of the block, when special validation may apply.
- @return array|boolean An array containing the validation errors, or false if there are no errors.
acf_set_after_rest_media_enqueue_reset_flag()
Set ACF data before a rest call if media scripts have not been enqueued yet for after REST reset.
- @date 07/06/22
- @since ACF 6.0
- @param WP_REST_Response|WP_HTTP_Response|WP_Error|mixed $response The WordPress response object.
- @return mixed
acf_reset_media_enqueue_after_rest()
Reset wp_enqueue_media action count after REST call so it can happen inside the main execution if required.
- @date 07/06/22
- @since ACF 6.0
- @param WP_REST_Response|WP_HTTP_Response|WP_Error|mixed $response The WordPress response object.
- @return mixed
acf_block_uses_post_meta()
Checks if the provided block is configured to save/load post meta.
- @since ACF 6.3
- @param array $block The block to check.
- @return boolean
acf_add_block_meta_values()
Loads ACF field values from the post meta if the block is configured to do so.
- @since ACF 6.3
- @param array $block The block to get values for.
- @param integer $post_id The ID of the post to retrieve meta from.
- @return array
acf_save_block_meta_values()
Stores ACF field values in post meta for any blocks configured to do so.
- @since ACF 6.3
- @param integer $post_id The ID of the post being saved.
- @param WP_Post $post The post object.
- @return void
acf_get_block_meta_values_to_save()
Iterates over blocks in post content and retrieves values that need to be saved to post meta.
- @since ACF 6.3
- @param string $content The content saved for the post.
- @return array An array containing the field values that need to be saved.
acf_inline_toolbar_editing_attrs()
Helper function that returns the HTML attributes required for toolbar inline editing as a string or array.
- Required. A list of the fields, each of which will be displayed in the popup toolbar. Each field can be passed as one of the following.
- A string (e.g.
'my_field_name') An associative array with specific keys: - @type string $field_name The name of the field to display in the toolbar.
- @type string $field_icon An html tag, can be an svg, to be used as the toolbar icon. If not passed, the icon of the first field will be used.
- @type string $field_label A string to use as the label for the button in the toolbar.
- @type boolean $use_expanded_editor Default is false, which opens the field in the popover. Set to true to open in the expanded editor.
- @type string $popover_min_width Enter the CSS width value to use for the popover. Default is "300px".
- @param array $fields List of fields.
- @param array $args Additional options controlling toolbar display and behavior.
- @type string $toolbar_icon Optional. An html tag, can be an svg, to be used as the toolbar icon. If not passed, the icon of the first field will be used.
- @type string $toolbar_title Optional. A string to be used as the toolbar title. If not passed, the name of the first field will be used.
- @type string $uid Optional. A unique identifier that isn't used by any other inline fields in this block. Pass if you have 2 elements that conflict.
- @type boolean $return_array Optional. If true, returns an array of attributes suitable for wp_get_attachment_image(). Default false.
- @return string|array When $args['return_array'] is false (default): Returns a string of escaped HTML attributes ready for output. When $args['return_array'] is true: Returns an associative array of attribute names and escaped values. When using the array return value with wp_get_attachment_image(), no element will be rendered if the image field is empty. If users need an inline editing target for selecting an image, render a fallback element with the attributes returned by this function.
acf_inline_text_editing_attrs()
Helper function that returns the HTML attributes required for inline text editing as a string, escaped and ready for output.
- @param string $field_name A string which is the name of the field to update when the user types into the HTML element.
- @param array $args Array { Optional. An array of additional args which can control how the popover identifier is displayed.
- @type string $toolbar_icon Optional. An html tag, can be an svg, to be used as the toolbar icon. If not passed, the icon of the first field will be used.
- @type string $toolbar_title Optional. A string to be used as the toolbar title. If not passed, the name of the first field will be used.
- @type string $placeholder Optional. Optional. A string which will be used as the placeholder in the typable text area. }
- @return string A string containing the attributes.
acf_process_block_toolbar_fields()
This function prepares a fields array for being localized and used on the frontend as block toolbar fields.
- Required. A list of the fields, each of which will be displayed in the popup toolbar. Each field can be passed as one of the following.
- A string (e.g.
'my_field_name') An associative array with specific keys: - @type string $field_name The name of the field to display in the toolbar.
- @type string $field_icon An html tag, can be an svg, to be used as the toolbar icon. If not passed, the icon of the first field will be used.
- @type string $field_label A string to use as the label for the button in the toolbar.
- @param array $fields List of fields.
- @return array The array of fields, prepared for JS localization.
acf_inline_editing_field_is_empty()
Helper function for block render templates to check if an acf field has a value. This is relevant when autoInlineEditing is enabled for a block, because empty fields will have acf_auto_inline_editing_field_name_ + field_name as their value if they are empty.
- @param string $field_name Field name.
- @return boolean True if the field is empty, false if it has a value.
Compatibility Global Functions
acf_get_compatibility()
Returns true if compatibility is enabled for the given component.
- @date 20/1/15
- @since ACF 5.1.5
- @param string $name The name of the component to check.
- @return boolean
Datastore Global Functions
acf_is_using_datastore()
Whether the SCF datastore is enabled.
- The datastore requires WordPress 6.7+ and can be enabled via the
acf/settings/enable_datastorefilter. - @since ACF 6.8.1
- @return boolean
Deprecated Global Functions
acf_render_field_wrap_label()
acf_render_field_wrap_label
- Renders the field's label.
- @date 19/9/17
- @since ACF 5.6.3
- @deprecated 5.6.5
- @param array $field The field array.
- @return void
acf_render_field_wrap_description()
acf_render_field_wrap_description
- Renders the field's instructions.
- @date 19/9/17
- @since ACF 5.6.3
- @deprecated 5.6.5
- @param array $field The field array.
- @return void
acf_get_fields_by_id()
Returns and array of fields for the given $parent_id.
- @date 27/02/2014
- @since ACF 5.0.0.
- @deprecated 5.7.11
- @param integer $parent_id The parent ID.
- @return array
acf_update_option()
acf_update_option
- A wrapper for the WP update_option but provides logic for a 'no' autoload
- @date 4/01/2014
- @since ACF 5.0.0
- @deprecated 5.7.11
- @param string $option The option name.
- @param string $value The option value.
- @param string $autoload An optional autoload value.
- @return boolean
acf_get_field_reference()
acf_get_field_reference
- Finds the field key for a given field name and post_id.
- @date 26/1/18
- @since ACF 5.6.5
- @deprecated 5.6.8
- @param string $field_name The name of the field. eg 'sub_heading'
- @param mixed $post_id The post_id of which the value is saved against
- @return string $reference The field key
acf_get_dir()
acf_get_dir
- Returns the plugin url to a specified file.
- @date 28/09/13
- @since ACF 5.0.0
- @deprecated 5.6.8
- @param string $filename The specified file.
- @return string
Fields Global Functions
acf_register_field_type()
alias of acf()->fields->register_field_type()
- @type function
- @date 31/5/17
- @since ACF 5.6.0
- @param n/a
- @return n/a
acf_register_field_type_info()
alias of acf()->fields->register_field_type_info()
- @type function
- @date 31/5/17
- @since ACF 5.6.0
- @param n/a
- @return n/a
acf_get_field_type()
alias of acf()->fields->get_field_type()
- @type function
- @date 31/5/17
- @since ACF 5.6.0
- @param n/a
- @return n/a
acf_get_field_types()
alias of acf()->fields->get_field_types()
- @type function
- @date 31/5/17
- @since ACF 5.6.0
- @param n/a
- @return n/a
acf_get_field_types_info()
acf_get_field_types_info
- Returns an array containing information about each field type
- @date 18/6/18
- @since ACF 5.6.9
- @param type $var Description. Default.
- @return type Description.
acf_is_field_type()
alias of acf()->fields->is_field_type()
- @type function
- @date 31/5/17
- @since ACF 5.6.0
- @param n/a
- @return n/a
acf_get_field_type_prop()
This function will return a field type's property
- @type function
- @date 1/10/13
- @since ACF 5.0.0
- @param n/a
- @return (array)
acf_get_field_type_label()
This function will return the label of a field type
- @type function
- @date 1/10/13
- @since ACF 5.0.0
- @param n/a
- @return (array)
acf_field_type_supports()
Returns the value of a field type "supports" property.
- @since ACF 6.2.5
- @param string $name The name of the field type.
- @param string $prop The name of the supports property.
- @param mixed $default The default value if the property is not set.
- @return mixed The value of the supports property which may be false, or $default on failure.
acf_field_type_exists()
- @deprecated @see acf_is_field_type()
- @type function
- @date 1/10/13
- @since ACF 5.0.0
- @param $type (string)
- @return (boolean)
acf_get_field_categories_i18n()
Returns an array of localised field categories.
- @since ACF 6.1
- @return array
acf_get_grouped_field_types()
Returns an multi-dimensional array of field types "name => label" grouped by category
- @since ACF 5.0.0
- @return array
acf_get_combined_field_type_settings_tabs()
Returns an array of tabs for a field type. We combine a list of default tabs with filtered tabs. I.E. Default tabs should be static and should not be changed by the filtered tabs.
- @since ACF 6.1
- @return array Key/value array of the default settings tabs for field type settings.
acf_get_pro_field_types()
Get the PRO only fields and their core metadata.
- @since ACF 6.1
- @return array An array of all the pro field types and their field type selection required meta data.
Code Reference
Files
- Acf Bidirectional Functions
- Acf Field Functions
- Acf Field Group Functions
- Acf Form Functions
- Acf Helper Functions
- Acf Hook Functions
- Acf Input Functions
- Acf Internal Post Type Functions
- Acf Meta Functions
- Acf Post Functions
- Acf Post Type Functions
- Acf Taxonomy Functions
- Acf User Functions
- Acf Utility Functions
- Acf Value Functions
- Acf Wp Functions
- Assets
- Blocks
- Compatibility
- Datastore
- Deprecated
- Fields
- L10n
- Local Fields
- Local Json
- Local Meta
- Locations
- Loop
- Revisions
- Scf Ui Options Page Functions
- Upgrades
- Validation
L10n Global Functions
acf_get_locale()
Returns the current locale.
- @date 16/12/16
- @since ACF 5.5.0
- @return string
acf_load_textdomain()
acf_load_textdomain
- Loads the plugin's translated strings similar to load_plugin_textdomain().
- @date 8/1/19
- @since ACF 5.7.10
- @param string $locale The plugin's current locale.
- @return void
_acf_apply_language_cache_key()
_acf_apply_language_cache_key
- Applies the current language to the cache key.
- @date 23/1/19
- @since ACF 5.7.11
- @param string $key The cache key.
- @return string
Local Fields Global Functions
acf_enable_local()
acf_enable_local
- Enables the local filter.
- @date 22/1/19
- @since ACF 5.7.10
- @return void
acf_disable_local()
acf_disable_local
- Disables the local filter.
- @date 22/1/19
- @since ACF 5.7.10
- @return void
acf_is_local_enabled()
acf_is_local_enabled
- Returns true if local fields are enabled.
- @date 23/1/19
- @since ACF 5.7.10
- @return boolean
acf_get_local_store()
Returns either local store or a dummy store for the given name or post type.
- @date 23/1/19
- @since ACF 5.7.10
- @param string $name The store name.
- @param string $post_type The post type for the desired store.
- @return ACF_Data
acf_reset_local()
acf_reset_local
- Resets the local data.
- @date 22/1/19
- @since ACF 5.7.10
- @return void
acf_get_local_field_groups()
acf_get_local_field_groups
- Returns all local field groups.
- @date 22/1/19
- @since ACF 5.7.10
- @return array
acf_get_local_internal_posts()
Returns local ACF posts with the provided post type.
- @since ACF 6.1
- @param string $post_type The post type to check for.
- @return array|mixed
acf_have_local_field_groups()
acf_have_local_field_groups
- description
- @date 22/1/19
- @since ACF 5.7.10
- @param type $var Description. Default.
- @return type Description.
acf_count_local_field_groups()
acf_count_local_field_groups
- description
- @date 22/1/19
- @since ACF 5.7.10
- @param type $var Description. Default.
- @return type Description.
acf_add_local_field_group()
acf_add_local_field_group
- Adds a local field group.
- @date 22/1/19
- @since ACF 5.7.10
- @param array $field_group The field group array.
- @return boolean
acf_add_local_internal_post_type()
Adds a local ACF internal post type.
- @since ACF 6.1
- @param array $post The main ACF post array.
- @param string $post_type The post type being added.
- @return boolean
register_field_group()
register_field_group
- See acf_add_local_field_group().
- @date 22/1/19
- @since ACF 5.7.10
- @param array $field_group The field group array.
- @return void
acf_remove_local_field_group()
acf_remove_local_field_group
- Removes a field group for the given key.
- @date 22/1/19
- @since ACF 5.7.10
- @param string $key The field group key.
- @return boolean
acf_remove_local_internal_post_type()
Removes a local ACF post with the given key and post type.
- @since ACF 6.1
- @param string $key The ACF key.
- @param string $post_type The ACF post type.
- @return boolean
acf_is_local_field_group()
acf_is_local_field_group
- Returns true if a field group exists for the given key.
- @date 22/1/19
- @since ACF 5.7.10
- @param string $key The field group key.
- @return boolean
acf_is_local_internal_post_type()
Returns true if an ACF post exists for the given key.
- @since ACF 6.1
- @param string $key The ACF key.
- @param string $post_type The ACF post type.
- @return boolean
acf_is_local_field_group_key()
acf_is_local_field_group_key
- Returns true if a field group exists for the given key.
- @date 22/1/19
- @since ACF 5.7.10
- @param string $key The field group key.
- @return boolean
acf_is_local_internal_post_type_key()
Returns true if a local ACF post exists for the given key.
- @since ACF 6.1
- @param string $key The ACF post key.
- @param string $post_type The post type to check.
- @return boolean
acf_get_local_field_group()
acf_get_local_field_group
- Returns a field group for the given key.
- @date 22/1/19
- @since ACF 5.7.10
- @param string $key The field group key.
- @return (array|null)
acf_get_local_internal_post_type()
Returns an ACF post for the given key.
- @since ACF 6.1
- @param string $key The field group key.
- @param string $post_type The ACF post type.
- @return array|null
acf_add_local_fields()
acf_add_local_fields
- Adds an array of local fields.
- @date 22/1/19
- @since ACF 5.7.10
- @param array $fields An array of un prepared fields.
- @return void|array
acf_get_local_fields()
acf_get_local_fields
- Returns all local fields for the given parent.
- @date 22/1/19
- @since ACF 5.7.10
- @param string $parent The parent key.
- @return array
acf_have_local_fields()
acf_have_local_fields
- Returns true if local fields exist.
- @date 22/1/19
- @since ACF 5.7.10
- @param string $parent The parent key.
- @return boolean
acf_count_local_fields()
acf_count_local_fields
- Returns the number of local fields for the given parent.
- @date 22/1/19
- @since ACF 5.7.10
- @param string $parent The parent key.
- @return integer
acf_add_local_field()
acf_add_local_field
- Adds a local field.
- @date 22/1/19
- @since ACF 5.7.10
- @param array $field The field array.
- @param boolean $prepared Whether or not the field has already been prepared for import.
- @return void
_acf_generate_local_key()
_acf_generate_local_key
- Generates a unique key based on the field's parent.
- @date 22/1/19
- @since ACF 5.7.10
- @param string $key The field key.
- @return boolean
acf_remove_local_field()
acf_remove_local_field
- Removes a field for the given key.
- @date 22/1/19
- @since ACF 5.7.10
- @param string $key The field key.
- @return boolean
acf_is_local_field()
acf_is_local_field
- Returns true if a field exists for the given key or name.
- @date 22/1/19
- @since ACF 5.7.10
- @param string $key The field group key.
- @return boolean
acf_is_local_field_key()
acf_is_local_field_key
- Returns true if a field exists for the given key.
- @date 22/1/19
- @since ACF 5.7.10
- @param string $key The field group key.
- @return boolean
acf_get_local_field()
acf_get_local_field
- Returns a field for the given key.
- @date 22/1/19
- @since ACF 5.7.10
- @param string $key The field group key.
- @return (array|null)
_acf_apply_get_local_field_groups()
_acf_apply_get_local_field_groups
- Appends local field groups to the provided array.
- @date 23/1/19
- @since ACF 5.7.10
- @param array $field_groups An array of field groups.
- @return array
_acf_apply_get_local_internal_posts()
Appends local ACF internal post types to the provided array.
- @since ACF 6.1
- @param array $posts An array of ACF posts.
- @param string $post_type The ACF internal post type being loaded.
- @return array
_acf_apply_is_local_field_key()
_acf_apply_is_local_field_key
- Returns true if is a local key.
- @date 23/1/19
- @since ACF 5.7.10
- @param boolean $bool The result.
- @param string $id The identifier.
- @return boolean
_acf_apply_is_local_field_group_key()
_acf_apply_is_local_field_group_key
- Returns true if is a local key.
- @date 23/1/19
- @since ACF 5.7.10
- @param boolean $bool The result.
- @param string $id The identifier.
- @return boolean
_acf_apply_is_local_internal_post_type_key()
Returns true if is a local key.
- @since ACF 6.1
- @param boolean $bool The result.
- @param string $id The identifier.
- @param string $post_type The post type.
- @return boolean
_acf_do_prepare_local_fields()
_acf_do_prepare_local_fields
- Local fields that are added too early will not be correctly prepared by the field type class.
- @date 23/1/19
- @since ACF 5.7.10
- @return void
Local Json Global Functions
acf_get_local_json_files()
Returns an array of found JSON field group files.
- @date 14/4/20
- @since ACF 5.9.0
- @param string $post_type The ACF post type to get files for.
- @return array
acf_write_json_field_group()
Saves a field group JSON file.
- @date 5/12/2014
- @since ACF 5.1.5
- @param array $field_group The field group.
- @return boolean
acf_delete_json_field_group()
Deletes a field group JSON file.
- @date 5/12/2014
- @since ACF 5.1.5
- @param string $key The field group key.
- @return boolean True on success.
Local Meta Global Functions
acf_setup_meta()
acf_setup_meta
- Adds postmeta to storage.
- @date 8/10/18
- @since ACF 5.8.0 @see ACF_Local_Meta::add() for list of parameters.
- @return array
acf_reset_meta()
acf_reset_meta
- Removes postmeta to storage.
- @date 8/10/18
- @since ACF 5.8.0 @see ACF_Local_Meta::remove() for list of parameters.
- @return void
Locations Global Functions
acf_register_location_type()
Registers a location type.
- @date 8/4/20
- @since ACF 5.9.0
- @param string $class_name The location class name.
- @return (ACF_Location|false)
acf_get_location_types()
Returns an array of all registered location types.
- @date 8/4/20
- @since ACF 5.9.0
- @return array
acf_get_location_type()
Returns a location type for the given name.
- @date 18/2/19
- @since ACF 5.7.12
- @param string $name The location type name.
- @return (ACF_Location|null)
acf_get_location_rule_types()
Returns a grouped array of all location rule types.
- @date 8/4/20
- @since ACF 5.9.0
- @return array
acf_validate_location_rule()
Returns a validated location rule with all props.
- @date 8/4/20
- @since ACF 5.9.0
- @param array $rule The location rule.
- @return array
acf_get_location_rule_operators()
Returns an array of operators for a given rule.
- @date 30/5/17
- @since ACF 5.6.0
- @param array $rule The location rule.
- @return array
acf_get_location_rule_values()
Returns an array of values for a given rule.
- @date 30/5/17
- @since ACF 5.6.0
- @param array $rule The location rule.
- @return array
acf_match_location_rule()
Returns true if the provided rule matches the screen args.
- @date 30/5/17
- @since ACF 5.6.0
- @param array $rule The location rule.
- @param array $screen The screen args.
- @param array $field_group The field group array.
- @return boolean
acf_get_location_screen()
Returns ann array of screen args to be used against matching rules.
- @date 8/4/20
- @since ACF 5.9.0
- @param array $screen The screen args.
- @param array $deprecated Deprecated.
- @return array
acf_register_location_rule()
Alias of acf_register_location_type().
- @date 31/5/17
- @since ACF 5.6.0
- @param string $class_name The location class name.
- @return (ACF_Location|false)
acf_get_location_rule()
Alias of acf_get_location_type().
- @date 31/5/17
- @since ACF 5.6.0
- @param string $class_name The location class name.
- @return (ACF_Location|false)
acf_get_valid_location_rule()
Alias of acf_validate_location_rule().
- @date 30/5/17
- @since ACF 5.6.0
- @param array $rule The location rule.
- @return array
Loop Global Functions
acf_add_loop()
alias of acf()->loop->add_loop()
- @type function
- @date 6/10/13
- @since ACF 5.0.0
- @param n/a
- @return n/a
acf_update_loop()
alias of acf()->loop->update_loop()
- @type function
- @date 6/10/13
- @since ACF 5.0.0
- @param n/a
- @return n/a
acf_get_loop()
alias of acf()->loop->get_loop()
- @type function
- @date 6/10/13
- @since ACF 5.0.0
- @param n/a
- @return n/a
acf_remove_loop()
alias of acf()->loop->remove_loop()
- @type function
- @date 6/10/13
- @since ACF 5.0.0
- @param n/a
- @return bool
Revisions Global Functions
acf_save_post_revision()
This function will copy meta from a post to it's latest revision
- @type function
- @date 26/09/2016
- @since ACF 5.4.0
- @param $post_id (int)
- @return n/a
acf_get_post_latest_revision()
This function will return the latest revision for a given post
- @type function
- @date 25/06/2016
- @since ACF 5.3.8
- @param $post_id (int)
- @return $post_id (int)
Scf Ui Options Page Functions Global Functions
acf_get_ui_options_page()
Get an SCF UI options page as an array
- @since ACF 6.2
- @param integer|string $id The post ID being queried.
- @return array|false The UI options page array.
acf_get_raw_ui_options_page()
Retrieves a raw SCF UI options page.
- @since ACF 6.2
- @param integer|string $id The post ID.
- @return array|false The UI options page array.
acf_get_ui_options_page_post()
Gets a post object for an SCF UI options page.
- @since ACF 6.2
- @param integer|string $id The post ID, key, or name.
- @return object|boolean The post object, or false on failure.
acf_is_ui_options_page_key()
Returns true if the given identifier is an SCF UI options page key.
- @since ACF 6.2
- @param string $id The identifier.
- @return boolean
acf_validate_ui_options_page()
Validates an SCF UI options page.
- @since ACF 6.2
- @param array $ui_options_page The SCF UI options page array to validate.
- @return array|boolean
acf_translate_ui_options_page()
Translates the settings for an SCF UI options page.
- @since ACF 6.2
- @param array $ui_options_page The SCF UI options page array.
- @return array
acf_get_ui_options_pages()
Returns and array of SCF UI options pages for the given $filter.
- @since ACF 6.2
- @param array $filter An array of args to filter results by.
- @return array
acf_get_raw_ui_options_pages()
Returns an array of raw SCF UI options pages.
- @since ACF 6.2
- @return array
acf_filter_ui_options_pages()
Returns a filtered array of SCF UI options pages based on the given $args.
- @since ACF 6.2
- @param array $ui_options_pages An array of SCF UI options pages.
- @param array $args An array of args to filter by.
- @return array
acf_update_ui_options_page()
Updates an SCF UI options page in the database.
- @since ACF 6.2
- @param array $ui_options_page The main ACF UI options page array.
- @return array
acf_flush_ui_options_page_cache()
Deletes all caches for the provided ACF UI options page.
- @since ACF 6.2
- @param array $ui_options_page The SCF UI options page array.
- @return void
acf_delete_ui_options_page()
Deletes an ACF UI options page from the database.
- @since ACF 6.2
- @param integer|string $id The ACF UI options page ID, key or name.
- @return boolean True if the options page was deleted.
acf_trash_ui_options_page()
Trashes an ACF UI options page.
- @since ACF 6.2
- @param integer|string $id The UI options page ID, key, or name.
- @return boolean True if the options page was trashed.
acf_untrash_ui_options_page()
Restores an ACF UI options page from the trash.
- @since ACF 6.2
- @param integer|string $id The UI options page ID, key, or name.
- @return boolean True if the options page was untrashed.
acf_is_ui_options_page()
Returns true if the given params match an ACF UI options page.
- @since ACF 6.2
- @param array $ui_options_page The ACF UI options page array.
- @return boolean
acf_duplicate_ui_options_page()
Duplicates an ACF UI options page.
- @since ACF 6.2
- @param integer|string $id The ACF UI options page ID, key or name.
- @param integer $new_post_id Optional ID to override.
- @return array|boolean The new ACF UI options page, or false on failure.
acf_update_ui_options_page_active_status()
Activates or deactivates an ACF UI options page.
- @since ACF 6.2
- @param integer|string $id The ACF UI options page ID, key or name.
- @param boolean $activate True if the UI options page should be activated.
- @return boolean
acf_get_ui_options_page_edit_link()
Checks if the current user can edit the UI options page and returns the edit URL.
- @since ACF 6.2
- @param integer $post_id The ACF UI options page ID.
- @return string
acf_prepare_ui_options_page_for_export()
Returns a modified ACF UI options page ready for export.
- @since ACF 6.2
- @param array $ui_options_page The ACF UI options page array.
- @return array
acf_export_ui_options_page_as_php()
Exports an ACF UI options page as PHP.
- @since ACF 6.2
- @param array $ui_options_page The ACF UI options page array.
- @return string|boolean
acf_prepare_ui_options_page_for_import()
Prepares an ACF UI options page for the import process.
- @since ACF 6.2
- @param array $ui_options_page The ACF UI options page array.
- @return array
acf_import_ui_options_page()
Imports an ACF UI options page into the database.
- @since ACF 6.2
- @param array $ui_options_page The ACF UI options page array.
- @return array The imported options page.
Upgrades Global Functions
acf_has_upgrade()
acf_has_upgrade
- Returns true if this site has an upgrade available.
- @date 24/8/18
- @since ACF 5.7.4
- @return boolean
acf_upgrade_all()
Runs upgrade routines if this site has an upgrade available.
- @date 24/8/18
- @since ACF 5.7.4
acf_get_db_version()
acf_get_db_version
- Returns the ACF DB version.
- @date 10/09/2016
- @since ACF 5.4.0
- @return string
acf_update_db_version()
Updates the ACF DB version.
- @date 10/09/2016
- @since ACF 5.4.0
- @param string $version The new version.
- @return void
acf_upgrade_500()
acf_upgrade_500
- Version 5 introduces new post types for field groups and fields.
- @date 23/8/18
- @since ACF 5.7.4
- @return void
acf_upgrade_500_field_groups()
acf_upgrade_500_field_groups
- Upgrades all ACF4 field groups to ACF5
- @date 23/8/18
- @since ACF 5.7.4
- @return void
acf_upgrade_500_field_group()
acf_upgrade_500_field_group
- Upgrades a ACF4 field group to ACF5
- @date 23/8/18
- @since ACF 5.7.4
- @param object $ofg The old field group post object.
- @return array $nfg The new field group array.
acf_upgrade_500_fields()
acf_upgrade_500_fields
- Upgrades all ACF4 fields to ACF5 from a specific field group
- @date 23/8/18
- @since ACF 5.7.4
- @param object $ofg The old field group post object.
- @param array $nfg The new field group array.
- @return void
acf_upgrade_500_field()
acf_upgrade_500_field
- Upgrades a ACF4 field to ACF5
- @date 23/8/18
- @since ACF 5.7.4
- @param array $field The old field.
- @return array $field The new field.
acf_upgrade_550()
acf_upgrade_550
- Version 5.5 adds support for the wp_termmeta table added in WP 4.4.
- @date 23/8/18
- @since ACF 5.7.4
- @return void
acf_upgrade_550_termmeta()
acf_upgrade_550_termmeta
- Upgrades all ACF4 termmeta saved in wp_options to the wp_termmeta table.
- @date 23/8/18
- @since ACF 5.7.4
- @return void
acf_wp_upgrade_550_termmeta()
When the database is updated to support term meta, migrate ACF term meta data across.
- @date 23/8/18
- @since ACF 5.7.4
- @param string $wp_db_version The new $wp_db_version.
- @param string $wp_current_db_version The old (current) $wp_db_version.
- @return void
acf_upgrade_550_taxonomy()
acf_upgrade_550_taxonomy
- Upgrades all ACF4 termmeta for a specific taxonomy.
- @date 24/8/18
- @since ACF 5.7.4
- @param string $taxonomy The taxonomy name.
- @return void
Validation Global Functions
acf_add_validation_error()
Add validation error.
- Alias of acf()->validation->add_error()
- @type function
- @date 6/10/13
- @since ACF 5.0.0
- @param string $input name attribute of DOM element.
- @param string $message error message.
- @return void
acf_get_validation_errors()
Retrieve validation errors.
- Alias of acf()->validation->function()
- @type function
- @date 6/10/13
- @since ACF 5.0.0
- @return array|bool
acf_get_validation_error()
Get the validation error.
- Alias of acf()->validation->get_error()
- @type function
- @date 6/10/13
- @since ACF 5.0.0
- @since SCF 6.4.1 Added the $input parameter, which is required in the get_error method.
- @param string $input name attribute of DOM element.
- @return string|bool
acf_reset_validation_errors()
Reset Validation errors.
- Alias of acf()->validation->reset_errors()
- @type function
- @date 6/10/13
- @since ACF 5.0.0
- @return void
acf_validate_save_post()
This function will validate $_POST data and add errors
- @type function
- @date 25/11/2013
- @since ACF 5.0.0
- @param bool $show_errors if true, errors will be shown via a wp_die screen.
- @return bool
acf_validate_values()
This function will validate an array of field values
- @type function
- @date 6/10/13
- @since ACF 5.0.0
- @param array $values An array of field values.
- @param string $input_prefix The input element's name attribute.
- @return void
acf_validate_value()
This function will validate a field's value
- @type function
- @date 6/10/13
- @since ACF 5.0.0
- @param mixed $value The field value to validate.
- @param array $field The field array.
- @param string $input The input element's name attribute.
- @return boolean
Admin Commands Global Functions
acf_commands_init()
Initializes SCF commands integration
- This function handles the integration with WordPress Commands (Cmd+K / Ctrl+K), providing navigation commands for SCF admin pages and custom post types.
- The implementation follows these principles:
- Only loads in screens where WordPress commands are available.
- Performs capability checks to ensure users only see commands they can access.
- Core administrative commands are only shown to users with SCF admin capabilities.
- Custom post type commands are conditionally shown based on edit_posts capability for each specific post type.
- Post types must have UI enabled (show_ui setting) to appear in commands.
- @since SCF 6.5.0
Admin Notices Global Functions
acf_new_admin_notice()
Instantiates and returns a new model.
- @date 23/12/18
- @since ACF 5.8.0
- @param array $data Optional data to set.
- @return ACF_Admin_Notice
acf_render_admin_notices()
Renders all admin notices HTML.
- @date 10/1/19
- @since ACF 5.7.10
- @return void
acf_add_admin_notice()
Creates and returns a new notice.
- @date 17/10/13
- @since ACF 5.0.0
- @param string $text The admin notice text.
- @param string $type The type of notice (warning, error, success, info).
- @param boolean $dismissible Is this notification dismissible (default true) (since 5.11.0).
- @param boolean $persisted Store once a notice has been dismissed per user and prevent showing it again. (since ACF 6.1.0).
- @return ACF_Admin_Notice
Admin Tools Global Functions
acf_register_admin_tool()
Alias of acf()->admin_tools->register_tool()
- @type function
- @date 31/5/17
- @since ACF 5.6.0
- @param ACF_Admin_Tool $class The tool class.
- @return void
acf_get_admin_tools_url()
- This function will return the admin URL to the tools page
- @type function
- @date 31/5/17
- @since ACF 5.6.0
- @return string The URL to the tools page.
acf_get_admin_tool_url()
This function will return the admin URL to the tools page
- @type function
- @date 31/5/17
- @since ACF 5.6.0
- @param string $tool The tool name.
- @return string The URL to a particular tool's page.
Beta Features Global Functions
scf_register_admin_beta_feature()
Alias of acf()->admin_beta_features->register_beta_feature()
- @type function
- @since SCF 6.5.0
- @param string $beta_feature The beta feature class.
- @return void
scf_get_admin_beta_features_url()
This function will return the admin URL to the beta features page
- @type function
- @since SCF 6.5.0
- @return string The URL to the beta features page.
Admin
Files
Admin Views Global
Files
Navigation Global Functions
acf_print_menu_section()
Helper function for looping over the provided menu items and echoing out the necessary markup.
- @since ACF 6.2
- @param array $menu_items An array of menu items to print.
- @param string $section The section being printed.
- @return void
API Helpers Global Functions
acf_is_array()
This function will return true for a non empty array
- @since ACF 5.4.0
- @param mixed $array The variable to test.
- @return boolean
acf_has_setting()
Alias of acf()->has_setting()
- @since ACF 5.6.5
- @param string $name Name of the setting to check for.
- @return boolean
acf_raw_setting()
acf_raw_setting
- alias of acf()->get_setting()
- @since ACF 5.6.5
- @param n/a
- @return n/a
acf_update_setting()
acf_update_setting
- alias of acf()->update_setting()
- @since ACF 5.0.0
- @param $name (string)
- @param $value (mixed)
- @return n/a
acf_validate_setting()
acf_validate_setting
- Returns the changed setting name if available.
- @since ACF 5.6.5
- @param n/a
- @return n/a
acf_get_setting()
Alias of acf()->get_setting()
- @since ACF 5.0.0
- @param string $name The name of the setting to test.
- @param string $value An optional default value for the setting if it doesn't exist.
- @return n/a
acf_is_pro()
Returns whether the current plugin load is running with PRO features enabled.
- @since ACF 6.8
- @return bool
acf_get_internal_post_types()
Return an array of ACF's internal post type names
- @since ACF 6.1
- @return array An array of ACF's internal post type names
acf_append_setting()
acf_append_setting
- This function will add a value into the settings array found in the acf object
- @since ACF 5.0.0
- @param $name (string)
- @param $value (mixed)
- @return n/a
acf_get_data()
acf_get_data
- Returns data.
- @since ACF 5.0.0
- @param string $name
- @return mixed
acf_set_data()
acf_set_data
- Sets data.
- @since ACF 5.0.0
- @param string $name
- @param mixed $value
- @return n/a
acf_append_data()
Appends data to an existing key.
- @since ACF 5.9.0
- @param string $name The data name.
- @param mixed $data The data to append to name.
acf_init()
Alias of acf()->init() - the core ACF init function.
- @since ACF 5.0.0
acf_has_done()
acf_has_done
- This function will return true if this action has already been done
- @since ACF 5.3.2
- @param $name (string)
- @return (boolean)
acf_get_external_path()
This function will return the path to a file within an external folder
- @since ACF 5.5.8
- @param string $file Directory path.
- @param string $path Optional file path.
- @return string File path.
acf_get_external_dir()
This function will return the url to a file within an internal ACF folder
- @since ACF 5.5.8
- @param string $file Directory path.
- @param string $path Optional file path.
- @return string File path.
acf_plugin_dir_url()
This function will calculate the url to a plugin folder. Different to the WP plugin_dir_url(), this function can calculate for urls outside of the plugins folder (theme include).
- @since ACF 5.6.8
- @param string $file A file path inside the ACF plugin to get the plugin directory path from.
- @return string The plugin directory path.
acf_parse_args()
This function will merge together 2 arrays and also convert any numeric values to ints
- @since ACF 5.0.0
- @param array $args The configured arguments array.
- @param array $defaults The default properties for the passed args to inherit.
- @return array $args Parsed arguments with defaults applied.
acf_parse_types()
acf_parse_types
- This function will convert any numeric values to int and trim strings
- @since ACF 5.0.0
- @param $var (mixed)
- @return $var (mixed)
acf_parse_type()
acf_parse_type
- description
- @since ACF 5.0.9
- @param $post_id (int)
- @return $post_id (int)
acf_get_view()
This function will load in a file from the 'admin/views' folder and allow variables to be passed through
- @since ACF 5.0.0
- @param string $view_path
- @param array $view_args
acf_merge_atts()
acf_merge_atts
- description
- @since ACF 5.0.9
- @param $post_id (int)
- @return $post_id (int)
acf_nonce_input()
This function will create and echo a basic nonce input
- @since ACF 5.6.0
- @param string $nonce The nonce parameter string.
acf_extract_var()
This function will remove the var from the array, and return the var
- @since ACF 5.0.0
- @param array $extract_array an array passed as reference to be extracted.
- @param string $key The key to extract from the array.
- @param mixed $default_value The default value if it doesn't exist in the extract array.
- @return mixed Extracted var or default.
acf_extract_vars()
This function will remove the vars from the array, and return the vars
- @since ACF 5.0.0
- @param array $extract_array an array passed as reference to be extracted.
- @param array $keys An array of keys to extract from the original array.
- @return array An array of extracted values.
acf_get_sub_array()
acf_get_sub_array
- This function will return a sub array of data
- @since ACF 5.3.2
- @param $post_id (int)
- @return $post_id (int)
acf_get_post_types()
Returns an array of post type names.
- @since ACF 5.0.0
- @param array $args Optional. An array of key => value arguments to match against the post type objects. Default empty array.
- @return array A list of post type names.
acf_get_post_stati()
Function acf_get_post_stati()
- Returns an array of post status names.
- @since ACF 6.1.0
- @param array $args Optional. An array of key => value arguments to match against the post status objects. Default empty array.
- @return array A list of post status names.
acf_get_pretty_post_statuses()
Function acf_get_pretty_post_statuses()
- Returns a clean array of post status names.
- @since ACF 6.1.0
- @param array $post_statuses Optional. An array of post status objects. Default empty array.
- @return array An array of post status names.
acf_get_post_type_label()
acf_get_post_type_label
- This function will return a pretty label for a specific post_type
- @since ACF 5.4.0
- @param $post_type (string)
- @return (string)
acf_get_post_status_label()
Function acf_get_post_status_label()
- This function will return a pretty label for a specific post_status
- @since ACF 6.1.0
- @param string $post_status The post status.
- @return string The post status label.
acf_verify_nonce()
acf_verify_nonce
- This function will look at the $_POST['_acf_nonce'] value and return true or false
- @since ACF 5.0.0
- @param $nonce (string)
- @return (boolean)
acf_verify_ajax()
Returns true if the current AJAX request is valid. It's action will also allow WPML to set the lang and avoid AJAX get_posts issues
- @since ACF 5.2.3
- @param string $nonce The nonce to check.
- @param string $action The action of the nonce.
- @param bool $action_is_field Whether the action is a field key or not. Defaults to false.
- @param string $expected_field_type Optional field type the resolved field must be when $action_is_field is true. Prevents a nonce minted for one field type from being accepted by an AJAX handler that expects a different one. Defaults to empty (no type validation).
- @return boolean
acf_get_image_sizes()
acf_get_image_sizes
- This function will return an array of available image sizes
- @since ACF 5.0.0
- @param n/a
- @return (array)
acf_version_compare()
acf_version_compare
- Similar to the version_compare() function but with extra functionality.
- @since ACF 5.5.0
- @param string $left The left version number.
- @param string $compare The compare operator.
- @param string $right The right version number.
- @return boolean
acf_get_full_version()
acf_get_full_version
- This function will remove any '-beta1' or '-RC1' strings from a version
- @since ACF 5.5.0
- @param $version (string)
- @return (string)
acf_get_terms()
acf_get_terms
- This function is a wrapper for the get_terms() function
- @since ACF 5.4.0
- @param $args (array)
- @return (array)
acf_get_taxonomy_terms()
acf_get_taxonomy_terms
- This function will return an array of available taxonomy terms
- @since ACF 5.0.0
- @param $taxonomies (array)
- @return (array)
acf_decode_taxonomy_terms()
acf_decode_taxonomy_terms
- This function decodes the $taxonomy:$term strings into a nested array
- @since ACF 5.0.0
- @param $terms (array)
- @return (array)
acf_decode_taxonomy_term()
acf_decode_taxonomy_term
- This function will return the taxonomy and term slug for a given value
- @since ACF 5.0.0
- @param $string (string)
- @return (array)
acf_array()
acf_array
- Casts the value into an array.
- @since ACF 5.7.10
- @param mixed $val The value to cast.
- @return array
acf_unarray()
Returns a non-array value.
- @since ACF 5.8.10
- @param mixed $val The value to review.
- @return mixed
acf_get_array()
acf_get_array
- This function will force a variable to become an array
- @since ACF 5.0.0
- @param $var (mixed)
- @return (array)
acf_get_numeric()
acf_get_numeric
- This function will return numeric values
- @since ACF 5.4.0
- @param $value (mixed)
- @return (mixed)
acf_get_posts()
acf_get_posts
- Similar to the get_posts() function but with extra functionality.
- @since ACF 5.1.5
- @param array $args The query args.
- @return array
_acf_query_remove_post_type()
_acf_query_remove_post_type
- This function will remove the 'wp_posts.post_type' WHERE clause completely When using 'post__in', this clause is unnecessary and slow.
- @since ACF 5.1.5
- @param $sql (string)
- @return $sql
acf_get_grouped_posts()
acf_get_grouped_posts
- This function will return all posts grouped by post_type This is handy for select settings
- @since ACF 5.0.0
- @param array $args The query arguments.
- @param bool $enforce_read_permissions Whether to exclude posts the current user cannot read.
- @return array
_acf_orderby_post_type()
The internal ACF function to add order by post types for use in acf_get_grouped_posts
- @param string $orderby The current orderby value for a query.
- @param object $wp_query The WP_Query.
- @return string The potentially modified orderby string.
acf_get_pretty_user_roles()
acf_get_pretty_user_roles
- description
- @since ACF 5.3.2
- @param $post_id (int)
- @return $post_id (int)
acf_get_grouped_users()
acf_get_grouped_users
- This function will return all users grouped by role This is handy for select settings
- @since ACF 5.0.0
- @param $args (array)
- @return (array)
acf_json_encode()
acf_json_encode
- Returns json_encode() ready for file / database use.
- @since ACF 5.0.0
- @param array $json The array of data to encode.
- @return string
acf_str_exists()
acf_str_exists
- This function will return true if a sub string is found
- @since ACF 5.0.0
- @param $needle (string)
- @param $haystack (string)
- @return (boolean)
acf_debug()
A legacy function designed for developer debugging.
- @deprecated 6.2.6 Removed for security, but keeping the definition in case third party devs have it in their code.
- @since ACF 5.0.0
- @return false
acf_debug_start()
A legacy function designed for developer debugging.
- @deprecated 6.2.6 Removed for security, but keeping the definition in case third party devs have it in their code.
- @since ACF 5.0.0
- @return false
acf_debug_end()
A legacy function designed for developer debugging.
- @deprecated 6.2.6 Removed for security, but keeping the definition in case third party devs have it in their code.
- @since ACF 5.0.0
- @return false
acf_encode_choices()
acf_encode_choices
- description
- @since ACF 5.0.0
- @param $post_id (int)
- @return $post_id (int)
acf_str_replace()
acf_str_replace
- This function will replace an array of strings much like str_replace The difference is the extra logic to avoid replacing a string that has already been replaced This is very useful for replacing date characters as they overlap with each other
- @since ACF 5.3.8
- @param $post_id (int)
- @return $post_id (int)
acf_split_date_time()
acf_split_date_time
- This function will split a format string into separate date and time
- @since ACF 5.3.8
- @param $date_time (string)
- @return $formats (array)
acf_convert_date_to_php()
acf_convert_date_to_php
- This function converts a date format string from JS to PHP
- @since ACF 5.0.0
- @param $date (string)
- @return (string)
acf_convert_date_to_js()
acf_convert_date_to_js
- This function converts a date format string from PHP to JS
- @since ACF 5.0.0
- @param $date (string)
- @return (string)
acf_convert_time_to_php()
acf_convert_time_to_php
- This function converts a time format string from JS to PHP
- @since ACF 5.0.0
- @param $time (string)
- @return (string)
acf_convert_time_to_js()
acf_convert_time_to_js
- This function converts a date format string from PHP to JS
- @since ACF 5.0.0
- @param $time (string)
- @return (string)
acf_update_user_setting()
acf_update_user_setting
- description
- @since ACF 5.0.0
- @param $post_id (int)
- @return $post_id (int)
acf_get_user_setting()
acf_get_user_setting
- description
- @since ACF 5.0.0
- @param $post_id (int)
- @return $post_id (int)
acf_in_array()
acf_in_array
- description
- @since ACF 5.0.0
- @param $post_id (int)
- @return $post_id (int)
acf_get_valid_post_id()
acf_get_valid_post_id
- This function will return a valid post_id based on the current screen / parameter
- @since ACF 5.0.0
- @param $post_id (mixed)
- @return $post_id (mixed)
acf_get_post_id_info()
acf_get_post_id_info
- This function will return the type and id for a given $post_id string
- @since ACF 5.4.0
- @param $post_id (mixed)
- @return $info (array)
acf_isset_termmeta()
acf_isset_termmeta
- This function will return true if the termmeta table exists https://developer.wordpress.org/reference/functions/get_term_meta/
- @since ACF 5.4.0
- @param $post_id (int)
- @return $post_id (int)
acf_upload_files()
This function will walk through the $_FILES data and upload each found.
- @since ACF 5.0.9
- @param array $ancestors An internal parameter, not required.
acf_upload_file()
acf_upload_file
- This function will upload a $_FILE
- @since ACF 5.0.9
- @param $uploaded_file (array) array found from $_FILE data
- @return $id (int) new attachment ID
acf_update_nested_array()
acf_update_nested_array
- This function will update a nested array value. Useful for modifying the $_POST array
- @since ACF 5.0.9
- @param $array (array) target array to be updated
- @param $ancestors (array) array of keys to navigate through to find the child
- @param $value (mixed) The new value
- @return (boolean)
acf_is_screen()
acf_is_screen
- This function will return true if all args are matched for the current screen
- @since ACF 5.1.5
- @param $post_id (int)
- @return $post_id (int)
acf_is_acf_admin_screen()
Check if we're in an ACF admin screen
- @since ACF 6.2.2
- @return boolean Returns true if the current screen is an ACF admin screen.
acf_maybe_get()
acf_maybe_get
- This function will return a var if it exists in an array
- @since ACF 5.1.5
- @param $array (array) the array to look within
- @param $key (key) the array key to look for. Nested values may be found using '/'
- @param $default (mixed) the value returned if not found
- @return $post_id (int)
acf_get_attachment()
Returns an array of attachment data.
- @since ACF 5.1.5
- @param integer|WP_Post The attachment ID or object
- @return array|false
acf_get_truncated()
This function will truncate and return a string
- @since ACF 5.0.0
- @param string $text The text to truncate.
- @param integer $length The number of characters to allow in the string.
- @return string
acf_current_user_can_admin()
acf_current_user_can_admin
- This function will return true if the current user can administrate the ACF field groups
- @since ACF 5.1.5
- @param $post_id (int)
- @return $post_id (int)
scf_current_user_has_capability()
Checks if the current user has the SCF capability for programmatic access, without considering show_admin setting.
- @since 6.6.0
- @return bool True if the user has the ACF capability.
scf_numeric_to_int()
Casts a numeric value to an integer, returning 0 for floats that cannot be represented as an integer (NAN or outside the integer range). Casting such floats directly raises a deprecation notice on PHP 8.5+.
- @since 6.9.1
- @param mixed $value A numeric value (int, float, or numeric string).
- @return integer
acf_current_user_can_edit_post()
Wrapper function for current_user_can( 'edit_post', $post_id ).
- @since ACF 6.3.4
- @param integer $post_id The post ID to check.
- @return boolean
acf_current_user_can_edit_in_context()
Checks if the current user can edit a given ACF context.
- Handles post, user, term, comment, woo_order, block, and option contexts returned by acf_decode_post_id().
- @since 6.7.2
- @param array $post_id_info The result of acf_decode_post_id(), containing 'type' and 'id'.
- @param string $options_page_slug Optional. The options page menu slug, used to look up the page's capability.
- @return boolean
acf_get_filesize()
acf_get_filesize
- This function will return a numeric value of bytes for a given filesize string
- @since ACF 5.1.5
- @param $size (mixed)
- @return (int)
acf_format_filesize()
acf_format_filesize
- This function will return a formatted string containing the filesize and unit
- @since ACF 5.1.5
- @param $size (mixed)
- @return (int)
acf_get_valid_terms()
acf_get_valid_terms
- This function will replace old terms with new split term ids
- @since ACF 5.1.5
- @param $terms (int|array)
- @param $taxonomy (string)
- @return $terms
acf_validate_attachment()
acf_validate_attachment
- This function will validate an attachment based on a field's restrictions and return an array of errors
- @since ACF 5.2.3
- @param array $attachment attachment data. Changes based on context.
- @param array $field field settings containing restrictions.
- @param string $context context is different when uploading / preparing.
- @return $errors (array)
acf_translate()
acf_translate
- This function will translate a string using the new 'l10n_textdomain' setting Also works for arrays which is great for fields - select -> choices
- @since ACF 5.3.2
- @param mixed $string String or array containing strings to be translated.
- @return mixed
acf_maybe_add_action()
acf_maybe_add_action
- This function will determine if the action has already run before adding / calling the function
- @since ACF 5.3.2
- @param $post_id (int)
- @return $post_id (int)
acf_is_row_collapsed()
acf_is_row_collapsed
- This function will return true if the field's row is collapsed
- @since ACF 5.3.2
- @param $post_id (int)
- @return $post_id (int)
acf_get_attachment_image()
Return an image tag for the provided attachment ID
- @since ACF 5.5.0
- @deprecated 6.3.2
- @param integer $attachment_id The attachment ID
- @param string $size The image size to use in the image tag.
- @return false
acf_get_post_thumbnail()
acf_get_post_thumbnail
- This function will return a thumbnail image url for a given post
- @since ACF 5.3.8
- @param $post (obj)
- @param $size (mixed)
- @return (string)
acf_get_browser()
acf_get_browser
- Returns the name of the current browser.
- @since ACF 5.0.0
- @return string
acf_is_ajax()
acf_is_ajax
- This function will return true if performing a wp ajax call
- @since ACF 5.3.8
- @param n/a
- @return (boolean)
acf_format_date()
Returns a date value in a formatted string.
- @since ACF 5.3.8
- @param string $value The date value to format.
- @param string $format The format to use.
- @return string
acf_clear_log()
Previously, deletes the debug.log file.
- @since ACF 5.7.10
- @deprecated 6.2.7
acf_log()
acf_log
- description
- @since ACF 5.3.8
- @param $post_id (int)
- @return $post_id (int)
acf_dev_log()
acf_dev_log
- Used to log variables only if ACF_DEV is defined
- @since ACF 5.7.4
- @param mixed
- @return void
acf_doing()
acf_doing
- This function will tell ACF what task it is doing
- @since ACF 5.3.8
- @param $event (string)
- @param context (string)
- @return n/a
acf_is_doing()
acf_is_doing
- This function can be used to state what ACF is doing, or to check
- @since ACF 5.3.8
- @param $event (string)
- @param context (string)
- @return (boolean)
acf_is_plugin_active()
acf_is_plugin_active
-
This function will return true if the ACF plugin is active
-
May be included within a theme or other plugin
-
@since ACF 5.4.0
-
@param $basename (int)
-
@return $post_id (int)
acf_send_ajax_results()
acf_send_ajax_results
- This function will print JSON data for a Select2 AJAX query
- @since ACF 5.4.0
- @param $response (array)
- @return n/a
acf_is_sequential_array()
acf_is_sequential_array
- This function will return true if the array contains only numeric keys
- @source http://stackoverflow.com/questions/173400/how-to-check-if-php-array-is-associative-or-sequential
- @since ACF 5.4.0
- @param $array (array)
- @return (boolean)
acf_is_associative_array()
acf_is_associative_array
- This function will return true if the array contains one or more string keys
- @source http://stackoverflow.com/questions/173400/how-to-check-if-php-array-is-associative-or-sequential
- @since ACF 5.4.0
- @param $array (array)
- @return (boolean)
acf_add_array_key_prefix()
acf_add_array_key_prefix
- This function will add a prefix to all array keys Useful to preserve numeric keys when performing array_multisort
- @since ACF 5.4.0
- @param $array (array)
- @param $prefix (string)
- @return (array)
acf_remove_array_key_prefix()
acf_remove_array_key_prefix
- This function will remove a prefix to all array keys Useful to preserve numeric keys when performing array_multisort
- @since ACF 5.4.0
- @param $array (array)
- @param $prefix (string)
- @return (array)
acf_connect_attachment_to_post()
This function will connect an attachment (image etc) to the post Used to connect attachments uploaded directly to media that have not been attached to a post
- @since ACF 5.8.0 Added filter to prevent connection.
- @since ACF 5.5.4
- @param integer $attachment_id The attachment ID.
- @param integer $post_id The post ID.
- @return boolean True if attachment was connected.
acf_encrypt()
acf_encrypt
- This function will encrypt a string using PHP https://bhoover.com/using-php-openssl_encrypt-openssl_decrypt-encrypt-decrypt-data/
- @since ACF 5.5.8
- @param string $data The data to encrypt.
- @return string|false Encrypted string, or false when OpenSSL is unavailable.
acf_decrypt()
Decrypts an encrypted string using PHP. https://bhoover.com/using-php-openssl_encrypt-openssl_decrypt-encrypt-decrypt-data/
- @since ACF 5.5.8
- @param string $data The string to decrypt.
- @return string|false Decrypted string, or false if the payload is malformed, unauthenticated, or decryption fails.
acf_parse_markdown()
acf_parse_markdown
- A very basic regex-based Markdown parser function based off slimdown.
- @since ACF 5.7.2
- @param string $text The string to parse.
- @return string
acf_get_sites()
acf_get_sites
- Returns an array of sites for a network.
- @since ACF 5.4.0
- @return array
acf_convert_rules_to_groups()
acf_convert_rules_to_groups
- Converts an array of rules from ACF4 to an array of groups for ACF5
- @since ACF 5.7.4
- @param array $rules An array of rules.
- @param string $anyorall The anyorall setting used in ACF4. Defaults to 'any'.
- @return array
acf_register_ajax()
acf_register_ajax
- Registers an ajax callback.
- @since ACF 5.7.7
- @param string $name The ajax action name.
- @param array $callback The callback function or array.
- @param boolean $public Whether to allow access to non logged in users.
- @return void
acf_str_camel_case()
acf_str_camel_case
- Converts a string into camelCase. Thanks to https://stackoverflow.com/questions/31274782/convert-array-keys-from-underscore-case-to-camelcase-recursively
- @since ACF 5.8.0
- @param string $string The string ot convert.
- @return string
acf_array_camel_case()
acf_array_camel_case
- Converts all array keys to camelCase.
- @since ACF 5.8.0
- @param array $array The array to convert.
- @return array
acf_is_block_editor()
Returns true if the current screen is using the block editor.
- @since ACF 5.8.0
- @return boolean
acf_get_wp_reserved_terms()
Return an array of the WordPress reserved terms
- @since ACF 6.1
- @return array The WordPress reserved terms list.
acf_is_multisite_sub_site()
Detect if we're on a multisite subsite.
- @since ACF 6.2.4
- @return boolean true if we're in a multisite install and not on the main site
acf_is_multisite_main_site()
Detect if we're on a multisite main site.
- @since ACF 6.2.4
- @return boolean true if we're in a multisite install and on the main site
API Template Global Functions
get_field()
This function will return a custom field value for a specific field name/key + post_id. There is a 3rd parameter to turn on/off formatting. This means that an image field will not use its 'return option' to format the value but return only what was saved in the database
- @since ACF 3.6
- @param string $selector The field name or key.
- @param mixed $post_id The post_id of which the value is saved against.
- @param boolean $format_value Whether or not to format the value as described above.
- @param boolean $escape_html If we're formatting the value, make sure it's also HTML safe.
- @return mixed
the_field()
This function is the same as echo get_field(), but will escape the value for safe HTML output regardless of parameters.
- @since ACF 1.0.3
- @param string $selector The field name or key.
- @param mixed $post_id The post_id of which the value is saved against.
- @param boolean $format_value Enable formatting of value. Default true.
- @return void
_acf_log_escaped_html()
Logs instances of ACF successfully escaping unsafe HTML.
- @since ACF 6.2.5
- @param string $function The function that resulted in HTML being escaped.
- @param string $selector The selector (field key, name, etc.) passed to that function.
- @param array $field The field being queried when HTML was escaped.
- @param mixed $post_id The post ID the function was called on.
- @return void
_acf_get_escaped_html_log()
Returns an array of instances where HTML was altered due to escaping in the_field or a shortcode.
- @since ACF 6.2.5
- @return array
_acf_update_escaped_html_log()
Updates the array of instances where HTML was altered due to escaping in the_field or a shortcode.
- @since ACF 6.2.5
- @param array $escaped The array of instances.
- @return boolean True on success, or false on failure.
_acf_delete_escaped_html_log()
Deletes the array of instances where HTML was altered due to escaping in the_field or a shortcode.
Since ACF 6.2.7, also clears the legacy acf_will_escape_html_log option to clean up.
- @since ACF 6.2.5
- @return boolean True on success, or false on failure.
get_field_object()
This function will return an array containing all the field data for a given field_name.
- @since ACF 3.6
- @param string $selector The field name or key.
- @param mixed $post_id The post_id of which the value is saved against.
- @param boolean $format_value Whether to format the field value.
- @param boolean $load_value Whether to load the field value.
- @param boolean $escape_html Should the field return a HTML safe formatted value if $format_value is true.
- @return array|false $field
acf_maybe_get_field()
This function will return a field for the given selector. It will also review the field_reference to ensure the correct field is returned which makes it useful for the template API
- @since ACF 5.2.3
- @param $selector (mixed) identifier of field. Can be an ID, key, name or post object
- @param $post_id (mixed) the post_id of which the value is saved against
- @param $strict (boolean) if true, return a field only when a field key is found.
- @return $field (array)
acf_maybe_get_sub_field()
This function will attempt to find a sub field
- @since ACF 5.4.0
- @param $post_id (int)
- @return $post_id (int)
get_fields()
This function will return an array containing all the custom field values for a specific post_id. The function is not very elegant and wastes a lot of PHP memory / SQL queries if you are not using all the values.
- @since ACF 3.6
- @param mixed $post_id The post_id of which the value is saved against.
- @param boolean $format_value Whether or not to format the field value.
- @param boolean $escape_html Should the field return a HTML safe formatted value if $format_value is true.
- @return array|false Associative array where field name => field value, or false on failure.
get_field_objects()
This function will return an array containing all the custom field objects for a specific post_id. The function is not very elegant and wastes a lot of PHP memory / SQL queries if you are not using all the fields / values.
- @since ACF 3.6
- @param mixed $post_id The post_id of which the value is saved against.
- @param boolean $format_value Whether or not to format the field value.
- @param boolean $load_value Whether or not to load the field value.
- @param boolean $escape_html Should the field return a HTML safe formatted value if $format_value is true.
- @return array|false Associative array where field name => field, or false on failure.
have_rows()
Checks if a field (such as Repeater or Flexible Content) has any rows of data to loop over. This function is intended to be used in conjunction with the_row() to step through available values.
- @since ACF 4.3.0
- @param string $selector The field name or field key.
- @param mixed $post_id The post ID where the value is saved. Defaults to the current post.
- @return boolean
the_row()
This function will progress the global repeater or flexible content value 1 row
- @since ACF 4.3.0
- @param N/A
- @return (array) the current row data
get_row_sub_field()
This function is used inside a 'has_sub_field' while loop to return a sub field object
- @since ACF 5.3.8
- @param $selector (string)
- @return (array)
get_row_sub_value()
This function is used inside a 'has_sub_field' while loop to return a sub field value
- @since ACF 5.3.8
- @param $selector (string)
- @return (mixed)
reset_rows()
This function will find the current loop and unset it from the global array. To be used when loop finishes or a break is used
- @since ACF 5.0.0
- @param $hard_reset (boolean) completely wipe the global variable, or just unset the active row
- @return (boolean)
has_sub_field()
This function is used inside a while loop to return either true or false (loop again or stop). When using a repeater or flexible content field, it will loop through the rows until there are none left or a break is detected
- @since ACF 1.0.3
- @param $field_name (string) the field name
- @param $post_id (mixed) the post_id of which the value is saved against
- @return (boolean)
has_sub_fields()
Alias of has_sub_field
get_sub_field()
This function is used inside a 'has_sub_field' while loop to return a sub field value
- @since ACF 1.0.3
- @param string $selector The field name or key.
- @param boolean $format_value Whether or not to format the value as described above.
- @param boolean $escape_html If we're formatting the value, make sure it's also HTML safe.
- @return mixed
the_sub_field()
This function is the same as echo get_sub_field(), but will escape the value for safe HTML output.
- @since ACF 1.0.3
- @param string $field_name The field name.
- @param boolean $format_value Enable formatting of value. When false, the field value will be escaped at this level with
acf_esc_html. Default true. - @return void
get_sub_field_object()
This function is used inside a 'has_sub_field' while loop to return a sub field object
- @since ACF 3.5.8.1
- @param string $selector The field name or key.
- @param boolean $format_value Whether to format the field value.
- @param boolean $load_value Whether to load the field value.
- @param boolean $escape_html Should the field return a HTML safe formatted value.
- @return mixed
get_row_layout()
This function will return a string representation of the current row layout within a 'have_rows' loop
- @since ACF 3.0.6
- @return mixed
acf_shortcode()
This function is used to add basic shortcode support for the ACF plugin eg. [acf field="heading" post_id="123" format_value="1"]
- @since ACF 1.1.1
- @param array $atts The shortcode attributes.
- @return string|void
update_field()
This function will update a value in the database
- @since ACF 3.1.9
- @param string $selector The field name or key.
- @param mixed $value The value to save in the database.
- @param mixed $post_id The post_id of which the value is saved against.
- @return boolean
update_sub_field()
This function will update a value of a sub field in the database
- @since ACF 5.0.0
- @param $selector (mixed) the sub field name or key, or an array of ancestors
- @param $value (mixed) the value to save in the database
- @param $post_id (mixed) the post_id of which the value is saved against
- @return boolean
delete_field()
This function will remove a value from the database
- @since ACF 3.1.9
- @param $selector (string) the field name or key
- @param $post_id (mixed) the post_id of which the value is saved against
- @return boolean
delete_sub_field()
This function will delete a value of a sub field in the database
- @since ACF 5.0.0
- @param $selector (mixed) the sub field name or key, or an array of ancestors
- @param $value (mixed) the value to save in the database
- @param $post_id (mixed) the post_id of which the value is saved against
- @return (boolean)
add_row()
This function will add a row of data to a field
- @since ACF 5.2.3
- @param $selector (string)
- @param $row (array)
- @param $post_id (mixed)
- @return (boolean)
add_sub_row()
This function will add a row of data to a field
- @since ACF 5.2.3
- @param $selector (string)
- @param $row (array)
- @param $post_id (mixed)
- @return (boolean)
update_row()
This function will update a row of data to a field
- @since ACF 5.2.3
- @param $selector (string)
- @param $i (int)
- @param $row (array)
- @param $post_id (mixed)
- @return (boolean)
update_sub_row()
This function will add a row of data to a field
- @since ACF 5.2.3
- @param $selector (string)
- @param $row (array)
- @param $post_id (mixed)
- @return (boolean)
delete_row()
This function will delete a row of data from a field
- @since ACF 5.2.3
- @param $selector (string)
- @param $i (int)
- @param $post_id (mixed)
- @return (boolean)
delete_sub_row()
This function will add a row of data to a field
- @since ACF 5.2.3
- @param $selector (string)
- @param $row (array)
- @param $post_id (mixed)
- @return (boolean)
create_field()
Deprecated Functions
- These functions are outdated
- @since ACF 1.0.0
- @param n/a
- @return n/a
API Term Global Functions
acf_get_taxonomies()
Returns an array of taxonomy names.
- @date 7/10/13
- @since ACF 5.0.0
- @param array $args An array of args used in the get_taxonomies() function.
- @return array An array of taxonomy names.
acf_get_taxonomies_for_post_type()
acf_get_taxonomies_for_post_type
- Returns an array of taxonomies for a given post type(s)
- @date 7/9/18
- @since ACF 5.7.5
- @param string|array $post_types The post types to compare against.
- @return array
acf_get_taxonomy_labels()
Returns an array of taxonomies in the format "name => label" for use in a select field.
- @date 3/8/18
- @since ACF 5.7.2
- @param array $taxonomies Optional. An array of specific taxonomies to return.
- @return array
acf_get_term_title()
acf_get_term_title
- Returns the title for this term object.
- @date 10/9/18
- @since ACF 5.0.0
- @param object $term The WP_Term object.
- @return string
acf_get_grouped_terms()
acf_get_grouped_terms
- Returns an array of terms for the given query $args and groups by taxonomy name.
- @date 2/8/18
- @since ACF 5.7.2
- @param array $args An array of args used in the get_terms() function.
- @return array
_acf_terms_clauses()
_acf_terms_clauses
- Used in the 'terms_clauses' filter to order terms by taxonomy name.
- @date 2/8/18
- @since ACF 5.7.2
- @param array $pieces Terms query SQL clauses.
- @param array $taxonomies An array of taxonomies.
- @param array $args An array of terms query arguments.
- @return array $pieces
acf_get_pretty_taxonomies()
acf_get_pretty_taxonomies
- Deprecated in favor of acf_get_taxonomy_labels() function.
- @date 7/10/13
- @since ACF 5.0.0
- @deprecated 5.7.2
acf_get_term()
acf_get_term
- Similar to get_term() but with some extra functionality.
- @date 19/8/18
- @since ACF 5.7.3
- @param mixed $term_id The term ID or a string of "taxonomy:slug".
- @param string $taxonomy The taxonomyname.
- @return WP_Term
acf_encode_term()
acf_encode_term
- Returns a "taxonomy:slug" string for a given WP_Term.
- @date 27/8/18
- @since ACF 5.7.4
- @param WP_Term $term The term object.
- @return string
acf_decode_term()
acf_decode_term
- Decodes a "taxonomy:slug" string into an array of taxonomy and slug.
- @date 27/8/18
- @since ACF 5.7.4
- @param WP_Term $term The term object.
- @return string
acf_get_encoded_terms()
acf_get_encoded_terms
- Returns an array of WP_Term objects from an array of encoded strings
- @date 9/9/18
- @since ACF 5.7.5
- @param array $values The array of encoded strings.
- @return array
acf_get_choices_from_terms()
acf_get_choices_from_terms
- Returns an array of choices from the terms provided.
- @date 8/9/18
- @since ACF 5.7.5
- @param array $values and array of WP_Terms objects or encoded strings.
- @param string $format The value format (term_id, slug).
- @return array
acf_get_choices_from_grouped_terms()
acf_get_choices_from_grouped_terms
- Returns an array of choices from the grouped terms provided.
- @date 8/9/18
- @since ACF 5.7.5
- @param array $value A grouped array of WP_Terms objects.
- @param string $format The value format (term_id, slug).
- @return array
acf_get_choice_from_term()
acf_get_choice_from_term
- Returns an array containing the id and text for this item.
- @date 10/9/18
- @since ACF 5.7.6
- @param object $item The item object such as WP_Post or WP_Term.
- @param string $format The value format (term_id, slug)
- @return array
acf_get_term_post_id()
Returns a valid post_id string for a given term and taxonomy. No longer needed since WP introduced the termmeta table in WP 4.4.
- @date 6/2/17
- @since ACF 5.5.6
- @deprecated 5.9.2
- @param $taxonomy (string) The taxonomy type.
- @param $term_id (int) The term ID.
- @return (string)
Api
Files
ACF_Repeater_Table
ACF_Repeater_Table
- Helper class for rendering repeater tables.
Properties
$field
The main field array used to render the repeater.
- @var array
$sub_fields
An array containing the subfields used in the repeater.
- @var array
$value
The value(s) of the repeater field.
- @var array
$show_add
If we should show the "Add Row" button.
- @var boolean
$show_remove
If we should show the "Remove Row" button.
- @var boolean
$show_order
If we should show the order of the fields.
- @var boolean
Methods
__construct
Constructs the ACF_Repeater_Table class.
- @param array $field The main field array for the repeater being rendered.
setup
Sets up the field for rendering.
- @since ACF 6.0.0
- @return void
prepare_value
Prepares the repeater values for rendering.
- @since ACF 6.0.0
- @return array
render
Renders the full repeater table.
- @since ACF 6.0.0
- @return void
thead
Renders the table head.
- @since ACF 6.0.0
- @return void
rows
Renders or returns rows for the repeater field table.
- @since ACF 6.0.0
- @param boolean $should_return If we should return the rows or render them.
- @return array|void
row
Renders an individual row.
- @since ACF 6.0.0
- @param integer $i The row number.
- @param array $row An array containing the row values.
- @param boolean $should_return If we should return the row or render it.
- @return string|void
row_handle
Renders the row handle at the start of each row.
- @since ACF 6.0.0
- @param integer $i The current row number.
- @return void
row_actions
Renders the actions displayed at the end of each row.
- @since ACF 6.0.0
- @return void
table_actions
Renders the actions displayed underneath the table.
- @since ACF 6.0.0
- @return void
pagination
Renders the table pagination. Mostly lifted from the WordPress core WP_List_Table class.
- @since ACF 6.0.0
- @return void
Fields
Files
Form Front Global Functions
acf_form_head()
Functions
- alias of acf()->form->functions
- @type function
- @date 11/06/2014
- @since ACF 5.0.0
- @param n/a
- @return n/a
Forms
Files
Hooks
Files
Acf Rest API Functions Global Functions
acf_get_field_rest_schema()
Get the REST API schema for a given field.
- @param array $field
- @return array
acf_get_field_rest_links()
Get the REST API field links for a given field. The links are appended to the REST response under the _links property and provide API resource links to related objects. If a link is marked as 'embeddable', WordPress can load the resource in the main request under the_embedded property when the request contains the _embed URL parameter.
- @see \acf_field::get_rest_links() @see https://developer.wordpress.org/rest-api/using-the-rest-api/linking-and-embedding/
- @param string|integer $post_id
- @param array $field
- @return array
scf_rest_sanitize_user_sub_fields()
Replaces User subfield data with REST-safe values.
- @param mixed $formatted_value The formatted parent value.
- @param mixed $raw_value The raw parent value.
- @param array $sub_fields The parent field's subfields.
- @param string $output_property The subfield property used as the output key.
- @return mixed
scf_rest_sanitize_user_data()
Replaces formatted User field data with REST-safe values based on the field definition.
- @param mixed $formatted_value The formatted field value.
- @param mixed $raw_value The raw field value.
- @param array $field The field array.
- @return mixed
scf_rest_format_standard_value()
Applies standard field formatting while keeping User values safe for REST output.
- This does not apply the public acf/rest/format_value_for_rest filter.
- @param mixed $value The raw field value.
- @param string|int $post_id The post ID of the current object.
- @param array $field The field array.
- @return mixed
acf_format_value_for_rest()
Format a given field's value for output in the REST API.
- @param $value
- @param $post_id
- @param $field
- @param string $format 'light' for normal REST API formatting or 'standard' to apply ACF's normal field formatting.
- @return mixed
ACF_Rest_Api
Properties
$request
- @var ACF_Rest_Request
$embed_links
- @var ACF_Rest_Embed_Links
$rest_update_plan
Fields and updates resolved during the current REST request.
- @since SCF 6.9.5
- @var array|null
Methods
register_field
Register our custom property as a REST field.
get_schema
Dynamically generate the schema for the current request.
- @return array
validate_rest_arg
Validate the request args. Mostly a wrapper for rest_validate_request_arg(), but also
fires off a filter, so we can add some custom validation for specific fields.
- This will likely no longer be needed once WordPress implements something like
validate_callbackandsanitize_callbackfor nested schema properties, see: https://core.trac.wordpress.org/ticket/49960 - @param mixed $value
- @param \WP_REST_Request $request
- @param string $param
- @return boolean|WP_Error
load_fields
Load field values into the requested object. This method is not a part of any public API and is only public as it is required by WordPress.
- @param array $object An array representation of the post, term, or user object.
- @param string $field_name
- @param WP_REST_Request $request
- @param string $object_sub_type Note that this isn't the same as $this->object_type. This variable is more specific and can be a post type or taxonomy.
- @return array
check_bidirectional_target_permissions
Check bidirectional target permissions before the REST callback runs.
- @since SCF 6.9.5
- @param mixed $dispatch_result Result from an earlier dispatch filter.
- @param WP_REST_Request $request Current REST request.
- @return mixed|WP_Error
prepare_field_updates
Resolve incoming values against fields active for the REST object.
- @since SCF 6.9.5
- @param array $data Incoming ACF field values.
- @param integer $object_id Object ID, or zero for a create request.
- @param string $object_type ACF object type.
- @param string $object_sub_type Post type, taxonomy, or user.
- @return array Field, value, and submitted field name tuples.
update_fields
Update any incoming field values for the given object. This method is not a part of any public API and is only public as it is required by WordPress.
- @param array $data
- @param WP_Post|WP_Term|WP_User $object
- @param string $property 'acf'
- @param WP_REST_Request $request
- @param string $object_sub_type This will be the post type, the taxonomy, or 'user'.
- @return boolean|WP_Error
make_identifier
Make the ACF identifier string for the given object.
- @param integer $object_id
- @param string $object_type 'user', 'term', or 'post'
- @return string
object_type_has_field_group
Gets an array of the location types that a field group is configured to use.
- @param string $object_type 'user', 'term', or 'post'
- @param array $field_group The field group to check.
- @param array $location_types An array of location types.
- @return boolean
get_field_groups_by_object_type
Get all field groups for the provided object type.
- @param string $object_type 'user', 'term', or 'post'
- @return array An array of field groups that display for that location type.
get_field_groups_by_id
Get all field groups for a given object.
- @param integer $object_id
- @param string $object_type 'user', 'term', or 'post'
- @param string|null $object_sub_type The post type or taxonomy. When an $object_type of 'user' is in play, this can be ignored.
- @param array $scope Field group keys to limit the returned set of field groups to. This is used to scope field lookups to specific groups.
- @return array An array of matching field groups.
get_fields
Get all ACF fields for a given field group and allow third party filtering.
- @param array $field_group This could technically be other possible values supported by acf_get_fields() but in this context, we're only using the field group arrays.
- @param null|integer $object_id The ID of the object being prepared.
- @return array
ACF_Rest_Embed_Links
Class ACF_Rest_Embed_Links
- Manage the addition of embed links on supported REST endpoints.
Properties
$links
- @var array Links to add to the response. These can be flagged as embeddable and expanded when _embed is passed with the request.
Methods
hook_link_handlers
Hook into all REST-enabled post type, taxonomy, and the user controllers in order to prepare links.
prepare_links
Add links to internal property for subsequent use in \ACF_Rest_Embed_Links::load_item_links().
- @param $post_id
- @param array $field
load_item_links
Hook into the rest_prepare_{$type} filters and add links for the object being prepared.
- @param WP_REST_Response $response
- @param WP_Post|WP_User|WP_Term $item
- @param WP_REST_Request $request
- @return WP_REST_Response
ACF_Rest_Request
Class ACF_Rest_Request
Properties
$readonly_props
Define which private/protected class properties are allowed read access. Access to these is controlled in \ACF_Rest_Request::__get();
- @var string[]
$http_method
- @var string The HTTP request method for the current request. i.e; GET, POST, PATCH, PUT, DELETE, OPTIONS, HEAD
$current_route
- @var string The current route being requested.
$supported_routes
- @var array Route URL patterns we support.
$url_params
- @var array Parameters matched from the URL. e.g; object IDs.
$object_type
- @var string The underlying object type. e.g; post, term, user, etc.
$object_sub_type
- @var string The requested object type.
$child_object_type
- @var string The object type for a child object. e.g. post-revision, autosaves, etc.
Methods
parse_request
Determine all required information from the current request.
__get
Magic getter for accessing read-only properties. Should we ever need to enforce a getter method, we can do so here.
- @param string $name The desired property name.
- @return string|null
get_url_param
Get a URL parameter if found on the request URL.
- @param $param
- @return mixed|null
set_http_method
Determine the HTTP method of the current request.
set_current_route
Get the current REST route as determined by WordPress.
build_supported_routes
Build an array of route match patterns that we handle. These are the same as WordPress' core patterns except we are also matching the object type here as well.
set_url_params
Loop through supported routes to find matching pattern. Use matching pattern to determine any URL parameters.
set_object_types
Determine the object type and sub type from the requested route. We need to know both the underlying WordPress object type as well as post type or taxonomy in order to provide the right context when getting/updating fields.
get_post_type_by_rest_base
Find the REST enabled post type object that matches the given REST base.
- @param string $rest_base
- @return WP_Post_Type|null
get_taxonomy_by_rest_base
Find the REST enabled taxonomy object that matches the given REST base.
- @param $rest_base
- @return WP_Taxonomy|null
SCF_Rest_Types_Endpoint
Class SCF_Rest_Types_Endpoint
- Extends the /wp/v2/types endpoint to include SCF fields and source filtering.
- @since SCF 6.5.0
Methods
__construct
Initialize the class and register hooks.
- @since SCF 6.5.0
- @since 6.7.0 Simplified hook registration.
is_valid_source
Validate source parameter.
- @since 6.7.0
- @param string $source The source value to validate.
- @return bool True if valid, false otherwise.
request_has_permission
Checks whether the matched REST route permits the request.
- @since SCF 6.8.0
- @param array $handler The matched REST route handler.
- @param WP_REST_Request $request The request object.
- @return bool True when the route permission callback allows the request.
filter_types_request
Filter post types requests for individual post type requests.
- @since SCF 6.5.0
- @since 6.7.0 Use is_valid_source() helper method.
- @param mixed $response The current response.
- @param array $handler The handler for the route.
- @param WP_REST_Request $request The request object.
- @return mixed The response or WP_Error.
filter_post_type
Filter individual post type in the response.
- @since SCF 6.5.0
- @since 6.7.0 Use is_valid_source() helper method.
- @param WP_REST_Response $response The response object.
- @param WP_Post_Type $post_type The post type object.
- @param WP_REST_Request $request The request object.
- @return WP_REST_Response|null The filtered response or null.
get_source_post_types
Get post types for a specific source.
- @since SCF 6.5.0
- @param string $source The source to get post types for (core, scf, other).
- @return array An array of post type names for the specified source.
register_extra_fields
Register extra SCF fields for the post types endpoint.
- @since SCF 6.5.0
- @return void
get_scf_fields
Get SCF fields for a post type.
- @since SCF 6.5.0
- @param array $post_type_object The post type object.
- @return array Array of field data.
get_scf_post_id
Get the SCF internal post ID for a post type.
- Only exposed to users who can edit the post type definition, so that consumers (e.g. Command Palette commands) can rely on its presence as a capability check.
- @since SCF 6.8.3
- @param array $post_type_object The post type object.
- @return int|null The post ID if managed by SCF and editable by the current user, null otherwise.
get_field_schema
Get the schema for the SCF fields.
- @since SCF 6.5.0
- @return array The schema for the SCF fields.
register_parameters
Register the source parameter for the post types endpoint.
- @since SCF 6.5.0
get_source_param_definition
Get the source parameter definition
- @since SCF 6.5.0
- @since 6.7.0 Use VALID_SOURCES constant.
- @return array Parameter definition
add_parameter_to_endpoints
Add source parameter directly to the endpoints for proper documentation
- @since SCF 6.5.0
- @param array $endpoints The REST API endpoints.
- @return array Modified endpoints
add_collection_params
Add source parameter to the collection parameters for the types endpoint.
- @since SCF 6.5.0
- @param array $query_params JSON Schema-formatted collection parameters.
- @return array Modified collection parameters.
clean_types_response
Clean up null entries from the response
- @since SCF 6.5.0
- @param array $response The response data.
- @param WP_REST_Server $server The REST server instance.
- @param WP_REST_Request $request The original request.
- @return array The filtered response data.
REST API
Files
- Acf REST API Functions
- Class Acf REST API
- Class ACF REST Embed Links
- Class ACF REST Request
- Class ACF REST Types Endpoint
Architecture
This document explains the internal architecture of Secure Custom Fields.
Core Components
1. Field Management System
- Field type registration and validation
- Field rendering and display
- Data storage and retrieval
- Value sanitization and escaping
2. Post Type Management
- Custom post type registration
- Advanced configuration options
- WordPress core integration
- Rewrite rules and permalinks
3. Security Layer
- Input validation and sanitization
- Context-aware output escaping
- Permission and capability management
- Nonce verification
Plugin Structure
The plugin is organized into several key directories:
Core Directories
- includes/ - Core functionality
- fields/ - Field type definitions
- admin/ - Admin interface
- api/ - Public API
- assets/ - JS, CSS, and images
Directory Responsibilities
-
includes/
- Core plugin functionality
- Field type handling
- Post type management
- API endpoints
-
fields/
- Individual field type classes
- Field validation logic
- Field rendering code
- Field storage handling
-
admin/
- Admin interface components
- Settings pages
- Field group management
- Post type configuration
-
api/
- Public API endpoints
- Integration points
- External access methods
Loading Process
1. Plugin Initialization
- Load dependencies
- Set up autoloader
- Initialize core classes
2. WordPress Integration
- Register post types
- Add hooks and filters
- Set up admin menus
3. Feature Registration
- Register field types
- Set up API endpoints
- Initialize components
4. Admin Interface Setup
- Load admin scripts
- Set up field management
- Configure settings pages
Data Flow
-
Input Processing
- Form submission
- API requests
- AJAX calls
-
Data Validation
- Type checking
- Format validation
- Security verification
-
Storage
- WordPress post meta
- Custom tables
- Caching
-
Output
- Template functions
- REST API responses
- Admin interface
Core Concepts
This section covers the fundamental concepts and architecture of Secure Custom Fields.
In This Section
- Architecture - Understanding SCF's internal structure
- Security - Security principles and best practices
Overview
Secure Custom Fields is built on several core concepts that ensure security, flexibility, and extensibility. Understanding these concepts will help you make the most of the plugin.
Features
This section details all features available in Secure Custom Fields.
Core Features
- Post Types - Create and manage custom post types
- Fields - Available field types and their usage
- Local JSON - Save field definitions as versionable JSON files
- API - Programmatic access and integration
Feature Categories
-
Content Management
- Custom post types
- Custom taxonomies
- Field groups
-
Field Types
- Basic fields (text, textarea, etc.)
- Advanced fields (repeater, flexible content)
- Special fields (relationship, clone)
-
Developer Tools
- API endpoints
- Hooks and filters
- Helper functions
Available Fields
- Accordion - Group fields into collapsible sections
- Button Group - Select one option from a group of buttons
- Checkbox - Select one or more choices
- Clone - Duplicate and reuse existing field configurations
- Color Picker - Choose colors with a visual picker
- Date Picker - Select dates from a calendar
- Date/Time Picker - Select dates and times
- Email - Input and validate email addresses
- File - Upload and manage files
- Flexible Content - Create flexible content layouts
- Gallery - Manage collections of images
- Google Map - Add location data with Google Maps
- Group - Group fields together
- Icon Picker - Select from available icons
- Image - Upload and manage images
- Link - Create links with titles and targets
- Message - Display instructional text
- Number - Input numeric values
- oEmbed - Embed external content
- Page Link - Link to internal content
- Password - Securely input passwords
- Post Object - Relate to other posts
- Radio - Select one choice from options
- Range - Select a numeric value with a slider
Local JSON
Local JSON saves field group, post type, and taxonomy definitions as JSON files whenever they are edited. These files can be kept in version control, code-reviewed, and synced back into the database on other environments.
Save and load locations
By default, files are written to and loaded from an acf-json directory in the active theme. The locations are configurable:
acf/settings/save_json— the directory new files are written to.acf/json/save_paths— the full list of candidate save directories.acf/settings/load_json/acf/json/load_paths— the directories files are loaded from.
add_filter( 'acf/settings/save_json', function () {
return get_stylesheet_directory() . '/my-json';
} );
Multisite
On multisite installations, Local JSON files are only written for network super admins by default. Other requests — site administrators, WP-Cron, and WP-CLI commands run without a super admin --user — may only write to save path directories inside the current site's uploads directory, the only filesystem location WordPress isolates per site. The sites subdirectory of the uploads directory is always excluded, because on the main site it contains the other sites' files.
This prevents a site administrator from modifying field group definitions in locations shared across the network, such as a theme's acf-json directory. Reading (loading) Local JSON is unaffected.
To let a site write Local JSON without super admin involvement, point its save location at an existing directory inside that site's uploads directory:
add_filter( 'acf/settings/save_json', function () {
$uploads = wp_get_upload_dir();
return $uploads['basedir'] . '/scf-json';
} );
Note that the uploads directory is publicly readable on most servers, and files there are typically not tracked in version control. Workflows that keep Local JSON in a shared, version-controlled location on multisite should perform field group changes as a network super admin.
Custom Post Types
Learn how to create and manage custom post types with SCF.
Creating Post Types
Basic Usage
Create a custom post type through the admin interface:
Advanced Configuration
- Capabilities: Set custom capabilities for managing posts
- REST API: Enable and configure REST API support
- Archive Pages: Configure archive behavior and permalinks
- Custom Permalinks: Set up SEO-friendly URL structures
Best Practices
- Choose descriptive post type names
- Configure proper labels for better UX
- Plan taxonomy relationships
- Consider permalink structure
- Set appropriate capabilities
Examples
Common use cases for custom post types:
- Products
- Team Members
- Portfolio Items
- Testimonials
- Events
API Reference
The Secure Custom Fields API provides programmatic access to field data and plugin functionality.
Core Functions
Field Operations
- Get field values
- Update field data
- Delete field content
- Check field existence
Post Type Management
- Register post types
- Modify post type settings
- Handle custom capabilities
- Manage taxonomies
Integration Points
-
WordPress Core
- Post type registration
- Taxonomy integration
- Capability handling
-
Theme Integration
- Template functions
- Conditional tags
- Layout helpers
-
Plugin Compatibility
- REST API support
- Cache integration
- Query modifications
Best Practices
- Always sanitize input
- Validate data types
- Use proper escaping
- Check capabilities
- Follow WordPress coding standards
Field Documentation Guide
This directory contains documentation for all field types in Secure Custom Fields.
Structure
Each field type has its own directory containing:
index.md- Main documentation for the fieldtutorial.md- Step-by-step tutorial for implementing the field
Adding New Field Documentation
- Create a new directory for the field type
- Create both required files
- Follow the standard format for each file type
- Include code examples and use cases
Documentation Standards
(To be added).
Field Types
Documentation for all available field types in Secure Custom Fields.
Each field type has its own documentation and tutorial showing how to implement and use it effectively.
Available Fields
- Accordion - Group fields into collapsible sections
- Button Group - Select one option from a group of buttons
- Checkbox - Select one or more choices
- Clone - Duplicate and reuse existing field configurations
- Color Picker - Choose colors with a visual picker
- Date Picker - Select dates from a calendar
- Date/Time Picker - Select dates and times
- Email - Input and validate email addresses
- File - Upload and manage files
- Flexible Content - Create flexible content layouts
- Gallery - Manage collections of images
- Google Map - Add location data with Google Maps
- Group - Group fields together
- Icon Picker - Select from available icons
- Image - Upload and manage images
- Link - Create links with titles and targets
- Message - Display instructional text
- Number - Input numeric values
- oEmbed - Embed external content
- Page Link - Link to internal content
- Password - Securely input passwords
- Post Object - Relate to other posts
- Radio - Select one choice from options
- Range - Select a numeric value with a slider
- Repeater - Create repeatable groups of fields
- Select - Choose from dropdown options
- Separator - Add visual breaks between fields
- Tab - Organize fields into tabbed sections
- Taxonomy - Select taxonomy terms
- Text - Single line text input
- Textarea - Multi-line text input
- Time Picker - Select time values
- True/False - Toggle switch for yes/no choices
- URL - Input and validate web addresses
- User - Select WordPress users
- WYSIWYG - Rich text editor
Accordion Field
The Accordion field creates collapsible sections to organize your fields into logical groups. It helps improve the editing experience by reducing visual clutter and grouping related fields together.
Key Features
- Creates collapsible sections for field organization
- Can be set to open/closed by default
- Supports multiple open sections simultaneously
- Can act as an endpoint for previous accordion sections
Settings
- Open - Display this accordion as open on page load
- Multi-Expand - Allow this accordion to open without closing others
- Endpoint - Define an endpoint for the previous accordion to stop
Using the Accordion Field
Basic Setup
- Create a new Field Group
- Add an Accordion field
- Configure basic settings:
- Set a clear section title
- Choose if it should be open by default
- Decide if multiple sections can be open
Common Use Cases
-
Organizing Content Sections
- Group related fields together
- Use clear section names
- Consider the editing workflow
-
Creating Form Sections
- Basic Information
- Detailed Content
- Settings/Configuration
Tips
- Keep section names concise but descriptive
- Don't nest accordions too deeply
- Consider using endpoints to create clear breaks
- Group related fields logically
Button Group Field
Key Features
Settings
- Choices - Define the available options
- Default Value - Set the pre-selected option
- Return Format - Specify how the value should be returned
- Allow Null - Option to have no selection
Using the Button Group Field
Basic Setup
- Create a new Field Group
- Add a Button Group field
- Configure the choices:
- Add value:label pairs
- Set a default value
- Choose return format
Common Use Cases
-
Simple Toggle Options
- Yes/No choices
- Show/Hide settings
- Layout selections
-
Status Selection
- Draft/Review/Published
- Active/Inactive
- Priority levels
Tips
- Keep choices concise
- Use clear labels
- Consider mobile usability
- Limit number of options
Checkbox Field
The Checkbox field allows users to select one or multiple choices from a set of options. It's ideal for situations where multiple selections are needed or when users need to toggle specific options on/off.
Key Features
- Multiple option selection
- Toggle individual choices
- Customizable checkbox layout
- Flexible return format
Settings
- Choices - Define the available options
- Default Value - Set pre-selected options
- Layout - Choose between vertical or horizontal layout
- Allow Custom - Enable user-added choices
- Toggle All - Option to select/deselect all choices
Using the Checkbox Field
Basic Setup
- Create a new Field Group
- Add a Checkbox field
- Configure options:
- Add checkbox choices
- Set layout (vertical/horizontal)
- Choose return format
- Enable/disable "Select All"
Common Use Cases
-
Multiple Selection Lists
- Categories/Tags
- Feature toggles
- Permission settings
-
Option Configuration
- Settings panels
- Display preferences
- Content filters
Tips
Clone Field
The Clone field allows you to reuse existing fields or field groups in multiple locations. This helps maintain consistency and reduces the need to recreate commonly used field configurations.
Key Features
- Copy existing field configurations
- Clone individual fields or entire field groups
- Prefix labels to avoid naming conflicts
- Maintain synchronized settings across cloned instances
Settings
- Select Fields - Choose which fields or groups to clone
- Display - Control how the cloned fields appear
- Prefix Label - Add a prefix to cloned field labels
- Prefix Name - Add a prefix to cloned field names
Using the Clone Field
Basic Setup
- Create a new Field Group
- Add a Clone field
- Configure clone settings:
- Select fields/groups to clone
- Choose display format
- Set prefix options
- Configure labels
Common Use Cases
-
Reusable Field Sets
- Contact information
- Social media links
- Common metadata
-
Template Components
- Shared content blocks
- Repeated field patterns
- Standard form elements
Tips
- Use meaningful prefixes
- Consider data structure
- Keep cloned groups focused
- Document clone relationships
Color Picker Field
The Color Picker field provides an interactive interface for selecting colors. It supports both RGB and RGBA color formats and includes a visual color picker with opacity control.
Key Features
- Visual color selection interface
- RGB and RGBA color support
- Opacity/transparency control
- Default color presets
- Hex color input
Settings
- Default Value - Set a default color
- Return Format - Choose between string, array, or rgba format
- Enable Opacity - Allow transparency selection
Using the Color Picker Field
Basic Setup
- Create a new Field Group
- Add a Color Picker field
- Configure options:
- Set default color
- Enable/disable opacity
- Choose return format
- Set display preferences
Common Use Cases
-
Theme Customization
- Brand colors
- Background colors
- Text colors
-
Design Elements
- Button colors
- Border colors
- Overlay settings
Tips
- Consider color validation
- Use default colors strategically
- Document color usage
- Consider accessibility
Date Picker Field
The Date Picker field provides a calendar interface for selecting dates. It offers a user-friendly way to input and format dates consistently across your content.
Key Features
- Interactive calendar interface
- Customizable date formats
- Week starts on any day
- Restrict date ranges
- Multiple display formats
Settings
- Display Format - How the date appears to editors
- Return Format - How the date is stored/returned
- Week Starts On - Set first day of week
- First Day - Configure week start day
Using the Date Picker Field
Basic Setup
- Create a new Field Group
- Add a Date Picker field
- Configure options:
- Set display format
- Choose return format
- Configure week start day
- Set default value
Common Use Cases
-
Event Management
- Event dates
- Scheduling
- Deadlines
-
Content Planning
- Publication dates
- Campaign scheduling
- Time-sensitive content
Tips
- Use consistent date formats
- Consider timezone implications
- Set appropriate restrictions
- Use clear date formatting
Date Time Picker Field
The Date Time Picker field combines date and time selection into a single interface. It provides precise control over datetime values with both calendar and time input options.
Key Features
- Combined date and time selection
- Customizable date/time formats
- Time increment control
- Multiple display formats
- Timezone support
Settings
- Display Format - How the datetime appears to editors
- Return Format - How the datetime is stored/returned
- Week Starts On - Set first day of week
- Time Increment - Control minute stepping
Using the Date Time Picker Field
Basic Setup
- Create a new Field Group
- Add a Date Time Picker field
- Configure options:
- Set display format
- Choose return format
- Set time increment
- Configure default value
Common Use Cases
-
Event Scheduling
- Event start/end times
- Appointment booking
- Session timing
-
Content Scheduling
- Post scheduling
- Time-based features
- Automated tasks
Tips
- Consider time zone handling
- Use appropriate time increments
- Validate date ranges
- Clear datetime formatting
Email Field
The Email field provides a specialized input for email addresses. It includes built-in validation to ensure proper email format and can be configured with custom display options.
Key Features
- Email format validation
- Custom placeholder text
- Prepend/append text options
- Required field validation
- Multiple email support
Settings
- Default Value - Set a default email address
- Placeholder - Custom placeholder text
- Prepend - Add text before the input
- Append - Add text after the input
Using the Email Field
Basic Setup
- Create a new Field Group
- Add an Email field
- Configure options:
- Set placeholder text
- Add prepend/append text
- Configure validation
- Set default value
Common Use Cases
-
Contact Information
- Contact forms
- User profiles
- Directory listings
-
Notification Settings
- Alert recipients
- Newsletter subscriptions
- System notifications
Tips
- Use clear validation messages
- Consider multiple email support
- Add helpful placeholder text
- Validate email format
File Field
The File field enables file uploads and management through the WordPress media library. It supports various file types and provides flexible display options for the selected files.
Key Features
- Media library integration
- File type restrictions
- Size limitations
- Custom return formats
- Preview capabilities
Settings
- Library - Restrict to uploaded or all files
- Return Format - Array, URL, or ID
- Preview Size - Thumbnail display size
- Min/Max Size - File size restrictions
- Allowed File Types - Restrict accepted formats
Using the File Field
Basic Setup
- Create a new Field Group
- Add a File field
- Configure options:
- Set allowed file types
- Configure size limits
- Choose library restriction
- Set return format
Common Use Cases
-
Document Management
- PDF uploads
- Document attachments
- Resource libraries
-
Media Handling
- Download files
- Asset management
- Resource linking
Tips
- Restrict file types appropriately
- Set reasonable size limits
- Consider storage implications
- Use clear preview options
Flexible Content Field
The Flexible Content field provides a flexible content builder interface. It allows users to create dynamic layouts by selecting from predefined content block types and arranging them in any order.
Key Features
- Dynamic layout builder
- Multiple layout types
- Drag and drop ordering
- Nested content structures
- Customizable templates
Settings
- Layouts - Define available content block types
- Button Label - Customize the "Add Row" text
- Min/Max Layouts - Limit number of blocks
- Layout Settings - Configure each layout type
Using the Flexible Content Field
Basic Setup
- Create a new Field Group
- Add a Flexible Content field
- Configure layouts:
- Create layout types
- Add fields to each layout
- Set minimum/maximum
- Configure button labels
Common Use Cases
-
Page Building
- Content sections
- Landing pages
- Dynamic layouts
-
Content Management
- Article components
- Product displays
- Feature blocks
Tips
- Plan layouts carefully
- Use clear layout labels
- Consider nesting depth
- Optimize for editors
Gallery Field
The Gallery field enables management of multiple images in a single field. It provides an intuitive interface for uploading, ordering, and managing collections of images.
Key Features
- Multiple image upload
- Drag and drop ordering
- Image previews
- Bulk selection
- Media library integration
Settings
- Library - Restrict to uploaded or all images
- Min/Max Selection - Limit number of images
- Preview Size - Thumbnail display size
- Insert - Prepend or append new images
- Return Format - Array, URL, or ID
Using the Gallery Field
Basic Setup
- Create a new Field Group
- Add a Gallery field
- Configure options:
- Set image restrictions
- Choose preview size
- Configure min/max images
- Set insert position
Common Use Cases
-
Image Collections
- Photo galleries
- Product images
- Portfolio displays
-
Media Management
- Slideshows
- Image grids
- Media libraries
Tips
- Set appropriate image limits
- Consider thumbnail sizes
- Enable easy reordering
- Optimize image sizes
Google Map Field
The Google Map field provides an interactive map interface for selecting and storing location data. It integrates with the Google Maps API to offer address search and precise location picking.
Key Features
- Interactive map interface
- Address search functionality
- Latitude/longitude selection
- Custom map center point
- Zoom level control
Settings
- Center Latitude - Default map center point
- Center Longitude - Default map center point
- Zoom Level - Default map zoom
- Height - Map display height
- Return Format - Location data format
Using the Google Map Field
Basic Setup
- Create a new Field Group
- Add a Google Map field
- Configure options:
- Set default center point
- Configure zoom level
- Set map height
- Choose display format
Common Use Cases
-
Location Information
- Business locations
- Event venues
- Contact pages
-
Geographic Data
- Service areas
- Delivery zones
- Store locators
Tips
- Configure API key properly
- Set appropriate zoom levels
- Consider mobile display
- Use clear location markers
Group Field
The Group field allows you to organize multiple fields together into a single data structure. It helps create logical groupings of related fields and simplifies data organization.
Key Features
- Group multiple fields together
- Single data structure
- Simplified data retrieval
- Layout customization
- Nested field support
Settings
- Sub Fields - Add fields within the group
- Layout - Stack or table display format
- Return Format - Group or individual field values
Using the Group Field
Basic Setup
- Create a new Field Group
- Add a Group field
- Configure sub-fields:
- Add desired fields
- Arrange field layout
- Set labels
- Choose return format
Common Use Cases
Tips
- Keep groups focused
- Use clear labeling
- Consider data structure
- Plan field organization
Icon Picker Field
The Icon Picker field provides an interface for selecting icons from various sources including Dashicons, custom icon sets, or the media library.
Key Features
- Multiple icon source options
- Dashicons integration
- Media library support
- URL input option
- Visual icon preview
Settings
- Icon Library - Choose available icon sources
- Return Format - Icon class, URL, or array
- Preview Size - Icon display size
- Allow Custom - Enable custom icon URLs
Using the Icon Picker Field
Basic Setup
- Create a new Field Group
- Add an Icon Picker field
- Configure options:
- Select icon libraries
- Set preview size
- Configure return format
- Enable custom URLs
Common Use Cases
Tips
- Maintain icon consistency
- Consider icon sizing
- Use clear previews
- Document icon usage
Image Field
The Image field provides a dedicated interface for uploading and selecting images through the WordPress media library. It offers preview capabilities and multiple return format options.
Key Features
- Media library integration
- Image preview
- Size restrictions
- Format validation
- Multiple return formats
Settings
- Preview Size - Thumbnail display size
- Library - Restrict to uploaded or all images
- Min/Max Width/Height - Image dimension limits
- File Size Restrictions - Control upload sizes
- Return Format - Array, URL, or ID
Using the Image Field
Basic Setup
- Create a new Field Group
- Add an Image field
- Configure options:
- Set preview size
- Choose library type
- Configure size limits
- Set return format
Common Use Cases
-
Content Images
- Featured images
- Article photos
- Profile pictures
-
Design Elements
- Background images
- Logo uploads
- Banner images
Tips
- Set appropriate size limits
- Consider image dimensions
- Use meaningful preview sizes
- Plan for responsive display
Link Field
The Link field provides an interface for creating links with various properties. It allows users to select internal content, enter external URLs, and set link attributes.
Key Features
- Internal/external link support
- Link text customization
- Target attribute control
- Internal content picker
- WordPress link picker integration
Settings
- Return Format - Array or URL
- Default Value - Preset link data
- Display Format - How the link appears in admin
Using the Link Field
Basic Setup
- Create a new Field Group
- Add a Link field
- Configure options:
- Choose return format
- Set default value
- Configure display
- Enable/disable features
Common Use Cases
Tips
- Validate URLs properly
- Consider link targets
- Use clear link text
- Check for broken links
Message Field
The Message field displays instructional text or HTML content within the editing interface. It's useful for providing guidance, separating content sections, or displaying formatted information.
Key Features
- Custom HTML support
- No data storage
- Formatting options
- Visual organization
- Editor instructions
Settings
- Message - The content to display
- New Lines - Handle line breaks
- Escape HTML - Display HTML as text
- Format - Text formatting options
Using the Message Field
Basic Setup
- Create a new Field Group
- Add a Message field
- Configure options:
- Enter message content
- Set formatting options
- Configure HTML handling
- Choose display style
Common Use Cases
-
User Guidance
- Field instructions
- Section descriptions
- Important notices
-
Content Organization
- Section dividers
- Group headers
- Information blocks
Tips
- Keep messages concise
- Use clear formatting
- Consider visibility
- Update content regularly
Nav Menu Field
Key Features
- Different Return Value (Object, HTML, ID)
- Different Menu Container (nav, div)
- Ability to select no value
Settings
**Using the Nav Menu Field**
Basic Setup
To get started with the Nav Menu Field in SCF, follow these steps to configure and display a WordPress navigation menu:
Step 1: Create a New Field Group
First, create a new field group in Secure Custom Fields (SCF). This field group will hold your custom fields, including the Nav Menu field.
- Go to Custom Fields > Add New in your WordPress admin panel.
- Title your field group and choose the location rules for where this field group should be displayed (e.g., on a specific page or post type).
Step 2: Add a Nav Menu Field
Once you've created a new field group, add a new field of type Nav Menu. This field will allow users to select a navigation menu from the available menus on your site.
- Click Add Field within the field group.
- Set the Field Type to Nav Menu.
- Configure the necessary field options based on your needs.
Step 3: Configure Options
Configure the field options for the Nav Menu field to tailor it to your needs.
-
Return Value: Choose how you want the selected menu to be returned:
- Menu ID: The ID of the selected menu.
- Nav Menu HTML: The raw HTML of the selected menu.
- Nav Menu Object: The complete menu object, including properties like the menu name and term ID.
-
Menu Container: This option determines the wrapper tag for the menu when the Nav Menu HTML return format is selected. Common options include
div,nav, ornone. You can also add additional container tags using thewp_nav_menu_container_allowed_tagsfilter. -
Allow Null: Set this option to true or false to allow or disallow a null value (i.e., no menu selected). When true, an empty option will be available for the user to select.
Code Example: Basic Setup
Here's how you can implement the Nav Menu Field in a template file:
// Check if the Nav Menu Field has a value
$menu_id = get_field('your_nav_menu_field_name');
if ($menu_id) {
// Get the menu object or HTML based on your configuration
$menu_html = wp_nav_menu(array(
'menu' => $menu_id, // Use the menu ID
'container' => 'nav', // Use a 'nav' container
'echo' => false, // Don't output directly; return the HTML
));
echo $menu_html; // Output the menu HTML
}
Common Use Cases
- Use to Output WordPress Navigation Menu Anywhere:
The Nav Menu Field allows you to output a WordPress navigation menu in custom locations across your site, such as in custom templates, widgets, or shortcodes.
Tips
Number Field
The Number field provides an input specifically for numeric values. It includes validation and formatting options to ensure proper number handling.
Key Features
- Numeric validation
- Min/max restrictions
- Step increment control
- Custom formatting
- Prefix/suffix support
Settings
- Default Value - Preset number
- Placeholder - Input placeholder text
- Prepend - Text before the input
- Append - Text after the input
- Min - Minimum allowed value
- Max - Maximum allowed value
- Step - Number increment size
Using the Number Field
Basic Setup
- Create a new Field Group
- Add a Number field
- Configure options:
- Set min/max values
- Configure step size
- Add placeholder text
- Set default value
Common Use Cases
-
Numeric Input
- Quantities
- Ratings
- Measurements
-
Settings Control
- Display options
- Configuration values
- Numeric parameters
Tips
- Set appropriate ranges
- Use clear step intervals
- Consider validation needs
- Add helpful placeholders
oEmbed Field
The oEmbed field allows embedding external content from various providers like YouTube, Vimeo, and Twitter. It automatically handles the embedding process using WordPress's oEmbed functionality.
Key Features
- Support for multiple providers
- Automatic embed handling
- Preview capability
- Width/height control
- WordPress oEmbed integration
Settings
- Width - Maximum width of embedded content
- Height - Maximum height of embedded content
- Preview Size - Display size in admin
Availability
The live URL preview and search (which resolves a pasted URL into embed HTML on the fly) uses WordPress's registered oEmbed provider allowlist for anonymous visitors and users without the standard WordPress content-authoring capability (edit_posts). Users with content-authoring capability can also use WordPress oEmbed discovery. Already-stored oEmbed values continue to render normally for all viewers regardless of login state.
Using the oEmbed Field
Basic Setup
- Create a new Field Group
- Add an oEmbed field
- Configure options:
- Set width/height
- Configure preview
- Set display options
- Choose providers
Common Use Cases
-
Media Integration
- Video embeds
- Social media posts
- Audio content
-
External Content
- YouTube videos
- Twitter posts
- Spotify tracks
Tips
- Check provider compatibility
- Consider responsive sizing
- Test embed previews
- Validate URLs properly
Page Link Field
The Page Link field provides an interface for creating links to internal WordPress content. It allows selection of posts, pages, and custom post types with search functionality.
Key Features
- Internal content linking
- Multiple post type support
- Search functionality
- Archive URL support
- Multiple selection option
Settings
- Post Type - Select available content types
- Taxonomy - Filter by taxonomy terms
- Allow Archives - Enable archive URL selection
- Multiple Values - Allow multiple selections
- Allow Null - Make selection optional
Using the Page Link Field
Basic Setup
- Create a new Field Group
- Add a Page Link field
- Configure options:
- Select post types
- Configure taxonomy filters
- Set multiple selection
- Enable/disable archives
Common Use Cases
Tips
- Use clear selection filters
- Consider multiple selection needs
- Test search functionality
- Validate link targets
Password Field
The Password field provides a secure input for password data. It includes masking functionality and can be configured with various display options.
Key Features
- Masked input
- Custom placeholder text
- Prepend/append options
- Basic password validation
- Secure handling
Settings
- Placeholder - Input placeholder text
- Prepend - Text before the input
- Append - Text after the input
Using the Password Field
Basic Setup
- Create a new Field Group
- Add a Password field
- Configure options:
- Set placeholder text
- Add prepend/append
- Configure validation
- Set character limits
Common Use Cases
-
Security Settings
- API keys
- Access tokens
- Private credentials
-
User Management
- Password fields
- Security questions
- Access codes
Tips
- Use secure handling
- Clear validation rules
- Consider masking options
- Implement proper sanitization
Post Object Field
The Post Object field creates relationships with other WordPress posts, pages, or custom post types. It provides an intuitive interface for selecting and linking to other content.
Key Features
- Content relationship management
- Multiple post type support
- Advanced search functionality
- Single or multiple selection
- Bidirectional relationships
Settings
- Post Type - Select available content types
- Taxonomy - Filter by taxonomy terms
- Allow Null - Make selection optional
- Multiple Values - Allow multiple selections
- Return Format - Object, ID, or custom
Using the Post Object Field
Basic Setup
- Create a new Field Group
- Add a Post Object field
- Configure options:
- Select post types
- Set taxonomy filters
- Configure multiple selection
- Choose return format
Common Use Cases
-
Content Relationships
- Related posts
- Parent/child content
- Cross-references
-
Content Selection
- Featured content
- Resource lists
- Content linking
Tips
- Use clear search filters
- Consider relationship structure
- Plan for scalability
- Test search performance
Radio Field
The Radio field presents users with a list of options where they can select a single choice. It provides a clear visual representation of available options.
Key Features
- Single option selection
- Custom choice labels
- Vertical or horizontal layout
- Other/custom value option
- Clear visual feedback
Settings
- Choices - Define available options
- Default Value - Pre-selected option
- Layout - Vertical or horizontal display
- Allow Other - Enable custom value input
- Return Format - Value or label
Using the Radio Field
Basic Setup
- Create a new Field Group
- Add a Radio field
- Configure options:
- Add choice options
- Set layout format
- Configure default value
- Enable/disable features
Common Use Cases
-
Single Choice Selection
- Status options
- Display preferences
- Content types
-
Configuration Options
- Layout choices
- Setting selections
- Display modes
Tips
- Keep options clear
- Use logical ordering
- Consider mobile layout
- Provide clear labels
Range Field
The Range field provides a slider interface for selecting numeric values within a defined range. It offers an intuitive way to input numbers with visual feedback.
Key Features
- Slider interface
- Min/max value limits
- Step increment control
- Visual value display
- Prepend/append text
Settings
- Default Value - Starting position
- Min - Minimum allowed value
- Max - Maximum allowed value
- Step - Value increment size
- Prepend/Append - Add text before/after
Using the Range Field
Basic Setup
- Create a new Field Group
- Add a Range field
- Configure options:
- Set min/max values
- Configure step size
- Add prepend/append text
- Set default value
Common Use Cases
-
Numeric Ranges
- Volume controls
- Percentage settings
- Scale selections
-
Visual Settings
- Opacity levels
- Size adjustments
- Intensity controls
Tips
- Set intuitive ranges
- Use clear min/max values
- Consider step granularity
- Add helpful labels
Repeater Field
The Repeater field allows you to create a set of sub fields which can be repeated again and again.
Key Features
- Flexible row management
- Multiple field types support
- Nested repeater capability
- Row reordering
- Min/max rows control
Settings
- Sub Fields - Add fields to repeat
- Minimum Rows - Set required rows
- Maximum Rows - Limit total rows
- Layout - Table or block display
- Button Label - Customize add row text
Using the Repeater Field
Basic Setup
- Create a new Field Group
- Add a Repeater field
- Configure options:
- Add sub fields
- Set min/max rows
- Choose layout style
- Configure labels
Common Use Cases
-
Dynamic Content
- Social media links
- Team members
- Feature lists
-
Content Management
- Gallery items
- Related links
- Service offerings
Tips
- Plan field structure carefully
- Consider nesting depth
- Use clear labels
- Set appropriate limits
Select Field
The Select field provides a dropdown interface for selecting single or multiple options from a predefined list.
Key Features
- Single/multiple selection
- Custom choices
- Ajax loading support
- Placeholder text
- Conditional logic
Settings
- Choices - Define available options
- Default Value - Set initial selection
- Allow Null - Make selection optional
- Multiple - Enable multiple selections
- UI - Enhanced select interface
Using the Select Field
Basic Setup
- Create a new Field Group
- Add a Select field
- Configure options:
- Add choice options
- Set default value
- Configure UI settings
- Enable/disable features
Common Use Cases
-
Option Selection
- Status choices
- Category selection
- Preference settings
-
Data Filtering
- View options
- Content filtering
- Display settings
Tips
- Use clear option labels
- Consider grouping options
- Enable search for long lists
- Set meaningful defaults
Separator Field
The Separator field provides visual separation between fields in the editing interface. It helps organize and structure field layouts.
Key Features
- Visual organization
- Custom styling
- Layout control
- Group separation
- Visual hierarchy
Settings
- Label - Optional separator text
- Instructions - Field description
- Wrapper - CSS class options
Using the Separator Field
Basic Setup
- Create a new Field Group
- Add a Separator field
- Configure options:
- Set label text
- Add instructions
- Style wrapper
- Position field
Common Use Cases
-
Content Organization
- Section breaks
- Field grouping
- Visual hierarchy
-
Form Structure
- Content sections
- Logical breaks
- Visual spacing
Tips
- Use clear labels
- Keep consistent styling
- Consider spacing
- Group related fields
Tab Field
The Tab field creates navigation tabs to organize fields into sections. It improves the editing interface by grouping related fields together.
Key Features
- Field organization
- Visual navigation
- Grouped content
- Layout control
- Conditional display
Settings
- Placement - Top/Left alignment
- Endpoint - Tab section end
- Label - Tab name
- Instructions - Optional help text
Using the Tab Field
Basic Setup
- Create a new Field Group
- Add a Tab field
- Configure options:
- Set tab label
- Choose placement
- Set endpoint
- Add instructions
Common Use Cases
-
Content Organization
- Content sections
- Settings groups
- Form organization
-
Interface Design
- Complex forms
- Settings panels
- Data grouping
Tips
- Use clear tab labels
- Group related fields
- Consider tab order
- Plan section breaks
Taxonomy Field
The Taxonomy field creates an interface for selecting taxonomy terms. It supports multiple selection methods and term management.
Key Features
- Term selection
- Multiple display types
- Term creation
- Hierarchical support
- Load on demand
Settings
- Taxonomy - Choose taxonomy
- Appearance - Select UI style
- Allow Create - Enable term creation
- Load Terms - Auto-load options
- Save Terms - Term relationships
Using the Taxonomy Field
Basic Setup
- Create a new Field Group
- Add a Taxonomy field
- Configure options:
- Select taxonomy
- Choose field type
- Set load behavior
- Configure saving
Common Use Cases
-
Content Classification
- Categories
- Tags
- Custom taxonomies
-
Term Management
- Content organization
- Filtering systems
- Related content
Tips
- Choose appropriate UI
- Consider term hierarchy
- Enable term creation
- Plan relationship structure
Text Field
The Text field provides a standard single-line text input with various formatting and validation options.
Key Features
- Text input
- Character limits
- Placeholder text
- Prepend/append
- Custom formatting
Settings
- Default Value - Preset text
- Placeholder - Input helper text
- Character Limit - Set max length
- Prepend - Text before input
- Append - Text after input
Using the Text Field
Basic Setup
- Create a new Field Group
- Add a Text field
- Configure options:
- Set placeholder
- Add character limits
- Configure formatting
- Set default value
Common Use Cases
-
Basic Information
- Titles
- Names
- Short descriptions
- References
-
Form Elements
- Input fields
- Search boxes
- Labels
- Identifiers
Tips
- Use clear placeholders
- Set appropriate limits
- Consider validation
- Use meaningful defaults
Textarea Field
The Textarea field provides a multi-line text input for longer content with formatting options and character limits.
Key Features
- Multi-line text input
- Character counting
- Rows configuration
- New line handling
- Placeholder support
Settings
- Default Value - Preset content
- Placeholder - Helper text
- Character Limit - Max length
- Rows - Input height
- New Lines - Handling options
Using the Textarea Field
Basic Setup
- Create a new Field Group
- Add a Textarea field
- Configure options:
- Set rows
- Add placeholder
- Configure limits
- Set line handling
Common Use Cases
-
Long Text Content
- Descriptions
- Biographies
- Instructions
- Notes
-
Content Management
- Excerpts
- Summaries
- Meta descriptions
- Comments
Tips
- Set appropriate height
- Consider word limits
- Use clear placeholders
- Plan for formatting
Time Picker Field
The Time Picker field provides an interface for selecting time values with customizable display and increment options.
Key Features
- Time selection
- Format options
- Step intervals
- Range limits
- Display customization
Settings
- Display Format - Time format
- Return Format - Data format
- Time Increment - Minute steps
- Placeholder - Helper text
- Default Value - Preset time
Using the Time Picker Field
Basic Setup
- Create a new Field Group
- Add a Time Picker field
- Configure options:
- Set time format
- Choose increment
- Set default time
- Configure display
Common Use Cases
-
Schedule Management
- Event times
- Opening hours
- Appointment slots
-
Time Settings
- Scheduling
- Time restrictions
- Operating hours
Tips
- Use consistent formats
- Set appropriate steps
- Consider time zones
- Plan for validation
True/False Field
The True/False field provides a simple toggle switch for boolean values. It offers a clean interface for yes/no choices.
Key Features
- Toggle interface
- Custom labels
- Default state
- Message display
- UI customization
Settings
- Message - Field description
- Default Value - Initial state
- On Text - Custom label
- Off Text - Custom label
- UI - Style options
Using the True/False Field
Basic Setup
- Create a new Field Group
- Add a True/False field
- Configure options:
- Set message
- Choose default
- Configure labels
- Style interface
Common Use Cases
-
Simple Toggles
- Feature flags
- Display options
- Status switches
-
Settings Control
- Visibility settings
- Enable/disable
- Option toggles
Tips
- Use clear labels
- Set logical defaults
- Consider UI placement
- Plan conditional logic
URL Field
The URL field provides input for web addresses with validation and formatting options. It ensures proper URL format and structure.
Key Features
- URL validation
- Protocol handling
- Placeholder text
- Custom formatting
- Link preview
Settings
- Default Value - Preset URL
- Placeholder - Helper text
- Protocol - Required/optional
- Return Format - URL structure
Using the URL Field
Basic Setup
- Create a new Field Group
- Add a URL field
- Configure options:
- Set placeholder
- Configure protocol
- Set validation
- Choose format
Common Use Cases
-
Web Links
- Website URLs
- Social profiles
- Resource links
-
Reference Links
- Documentation
- External content
- Media sources
Tips
- Validate URLs properly
- Consider protocols
- Use clear placeholders
- Check link validity
User Field
The User field creates an interface for selecting WordPress users. It supports multiple selection methods and user filtering.
Key Features
- User selection
- Role filtering
- Multiple formats
- Search capability
- Multiple selection
Settings
- Roles - Filter by role
- Allow Null - Optional selection
- Multiple - Enable multiple
- Return Format - Object/ID/Array
- Filter - User query args
Using the User Field
Basic Setup
- Create a new Field Group
- Add a User field
- Configure options:
- Select roles
- Set return format
- Configure multiple
- Set filters
Common Use Cases
-
User Assignment
- Author selection
- Team members
- User permissions
-
User Relations
- Content ownership
- User groups
- Access control
Tips
- Filter appropriate roles
- Consider permissions
- Use clear search
- Plan user structure
WYSIWYG Field
The WYSIWYG (What You See Is What You Get) field provides a rich text editor with formatting tools and media integration.
Key Features
- Rich text editing
- Media integration
- Toolbar customization
- HTML handling
- Editor styles
Settings
- Toolbar - Editor tools
- Media Upload - Enable/disable
- Tabs - Visual/Text tabs
- Height - Editor height
- Default Value - Initial content
Using the WYSIWYG Field
Basic Setup
- Create a new Field Group
- Add a WYSIWYG field
- Configure options:
- Choose toolbar
- Set media options
- Configure height
- Set defaults
Common Use Cases
-
Rich Content
- Post content
- Product descriptions
- Page sections
-
Formatted Text
- Documentation
- Guidelines
- Formatted messages
Tips
- Configure appropriate tools
- Consider media handling
- Plan content structure
- Set consistent styling
Creating Your First Custom Field
A beginner-friendly guide to adding custom fields using Secure Custom Fields (SCF).
What is a custom field?
Custom fields let you add structured data to your content. With SCF, you can attach fields like text inputs, selects, image uploads, and more to your posts, pages, or custom post types.
Prerequisites
- SCF installed and activated
- A post type (default or custom) where you'll attach your fields
- Administrator access to WordPress
You can learn more about WordPress basics here:
1. Access the Admin Panel
- Go to SCF → Field Groups in your WordPress admin menu.
- Click "Add New" to create a new group of fields.
2. Basic Configuration
Field Group Title
Give your field group a descriptive name, like Movie Details or Product Specs.
Location Rules
Choose where this group should appear. For example:
- Post type is equal to
Movie - Page template is
Product Page
This ensures your fields appear only where you need them.
Note: This fine-grained control allows you to define SCF fields once and reuse them across different post types, templates, or components.
Active
Make sure the field group is set to Active so it appears in the editor.
Note: Some features require the field group to be enabled and exposed via the REST API. To future-proof your configuration, we recommend setting Show in REST to true when creating your field groups.
3. Adding Fields
To start building your custom field group, click the "Add Field" button.
Each field requires at least a few basic settings to work correctly. All other options are optional and can be used to improve the user experience in the editor.
Minimum Required Settings
In the General tab, you must define the following:
-
Field Type
Specifies what kind of data the field will store (e.g., Text, Image, Number, Select). -
Field Label
The human-readable name shown in the editor (e.g., “Movie Title”). -
Field Name
A unique identifier used in the code (lowercase, no spaces; underscores or dashes allowed).
📌 Example: Movie Fields
Let’s say you want to create a group of fields for movie entries. Here's how you could configure it:
| Field Label | Field Name | Field Type | Description |
|---|---|---|---|
| Movie Title | movie_title |
Text | Stores the name of the movie |
| Director | director |
Text | Stores the name of the director |
| Release Year | release_year |
Number | Stores the year the movie was released |
| Poster Image | poster |
Image | Upload an image file for the movie poster |
💡 These fields would be added one by one using the Add Field button, and each configured in the field editor panel.
General Settings
Defines the field behavior and how it is stored:
-
Field Type
What kind of input this field accepts (text, image, number, etc.). -
Field Label
The label shown to the user in the WordPress editor. -
Field Name
The code-safe name used to retrieve the value in your templates or plugins. -
Default Value
A pre-filled value shown if no value is entered.
Validation Settings
Used to restrict and control the kind of data that can be entered:
-
Required
Makes the field mandatory. -
Minimum / Maximum Values
For numeric or character-based fields. Useful for fields likerelease_year. -
Allowed Characters / Pattern
Use a regular expression to restrict input format (e.g., only digits). -
Custom Validation Message
Message shown if validation fails (e.g., “Please enter a valid year”).
Presentation Settings
Controls the visual appearance of the field in the editor:
-
Placeholder Text
Example text shown inside the field input. -
Instructions
Helper text shown below the field to guide users. -
Wrapper Attributes
Custom HTML attributes like class or ID for styling or JavaScript. -
Hide Label
Option to hide the field label (not recommended unless styled separately).
Conditional Logic
Used to show or hide fields based on the value of other fields:
-
Enable Conditions
Activate conditional display rules for this field. -
Condition Rules
Example: only show the “Director” field if “Content Type” equals “Movie”.
⚠️ Note: Some settings may not be available for all field types. The options shown will adapt depending on the field you're configuring.
Final Step
Repeat this process to add as many fields as needed to your group. Once ready, you can assign this field group to a post type and start entering content!
For Developers
While Secure Custom Fields makes it easier to manage and display custom fields with a user-friendly interface, WordPress also includes native support for custom fields that can be managed programmatically using functions like get_post_meta() and add_post_meta().
You can learn more about WordPress native custom fields here:
👉 WordPress Native Custom Fields
To access custom field values in your theme or plugin, use SCF functions you can learn more about SCF’s developer API in their official documentation.
Creating Your First Options Page
A step-by-step guide to building a global settings page using Secure Custom Fields (SCF).
What is an options page?
An options page is a custom admin screen where you can store site-wide settings that are not tied to individual posts, pages, or taxonomies. These values are ideal for:
- Contact details (phone, email, address)
- Social media links
- Global theme settings (colors, toggles, logos)
- Custom footer messages
- Business hours
How are these options related to themes?
Options pages let you manage shared values that appear across the theme — without editing code each time a change is needed.
Example: Company Phone Number
Suppose you want to display the company’s phone number in both the header and footer:
- Create an options page named
theme_options. - Add a text field called
phone_number. - Retrieve it in your classic theme like this:
<?php
$phone_number = get_option('phone_number');
echo $phone_number;
?>
This approach works with Classic Themes (non-block themes) where PHP templates are used for rendering.
Prerequisites
- SCF (Secure Custom Fields) installed and activated
- Administrator access to WordPress
- Basic understanding of WordPress admin
You can learn more about WordPress basics here:
1. Access the Admin Panel
- Go to Secure Custom Fields → Options Pages in your WordPress admin sidebar.
- Click "Add New" to create your options page.
2. Basic Configuration
Set up the following fields to define the behavior and placement of your options page:
Basic Settings Panel
- Page Title: The title displayed at the top of the options page (e.g.,
Site Settings). - Menu Slug: A unique identifier for the page URL (e.g.,
site-settings). - Parent Page: Choose
No Parentto create a standalone page or select a parent if it should appear as a submenu item. - Advanced Configuration: Enable to access additional options.
Advanced Settings Panel
Visibility
Description
- Description: A short description to help explain the purpose of this options page.
Labels
Permissions
- Capability: Required capability to view/edit this page (default is
edit_posts).
Data Storage
- Storage Location: Choose whether to store the data in the options table (default) or bind it to a specific post, user, or term.
- Custom Storage: Use a specific post ID (e.g.,
123) or context string (e.g.,user_1). - Autoload Options: Enable to automatically load these values when WordPress initializes — useful for performance.
Click Save to create the options page. Once saved, you can start adding custom fields as needed.
3. Adding Fields
Add fields just like you would for any post type or taxonomy.
Common Fields to Add
company_name— Company name (text)support_email— Support contact email (email)emergency_alert_message— Site-wide notice (textarea)global_logo— Logo image (image upload)
Each of these fields will be accessible from any page or template.
For Developers
Options pages provide a clean way to centralize configuration. In more advanced implementations, you can:
- Register multiple options pages for different sections (e.g., Branding, API Keys)
- Use
get_option()if working outside the SCF context - Integrate with theme customizers or other plugin logic
Secure Custom Fields simplifies this process, but WordPress also offers a native way to register and manage options pages through the Settings API. This allows full control over settings registration, sanitization, and display via code.
👉 Learn more about the WordPress Settings API: https://developer.wordpress.org/plugins/settings/settings-api/
Creating Your First Post Type
A step-by-step guide to creating a custom post type using Secure Custom Fields (SCF).
What is a custom post type?
In WordPress, a custom post type (CPT) is a content type like posts and pages, but customized to suit your specific needs. You can use CPTs to manage products, portfolios, testimonials, events, vehicles, and more—essentially any type of structured content that needs its own menu and fields.
Prerequisites
- SCF installed and activated
- Administrator access to WordPress
- Basic understanding of WordPress concepts
You can learn more about WordPress basics here:
1. Access the Admin Panel
To begin creating your custom post type:
- Go to Secure Custom Fields → Post Types in your WordPress admin menu.
- Click the "Add New" button to open the creation form.
2. Basic Configuration
These fields help you define how your post type will appear and behave:
Plural Label *
This is the name that will appear in the admin sidebar. For example, Movies.
Singular Label *
Used for individual entries. Example: Movie.
Post Type Key *
A technical identifier for WordPress to recognize this post type. Use lowercase letters and underscores only. Max 20 characters. Example: movie.
Taxonomies
Choose existing taxonomies like category or tags if you want to group or filter your content. You can also select custom ones like Brand or Color.
Public
Choose Yes to make your post type visible on the website and admin area. Choose No to keep it private.
Hierarchical
Set to Yes if you want your items to be nested (like pages). Set to No for a flat list (like blog posts).
Advanced Configuration
Enable this to unlock more advanced options, useful when you need more control over how your post type works.
3. Advanced Settings
These options let you customize deeper behaviors and labels.
Supports
Select which features to enable when editing a post, such as:
- Title: Adds a title field
- Editor: Main content box
- Featured Image: Allow image upload
- Comments, Author, Excerpt, etc.
Description
A short explanation of what this post type is about. Helpful for organization.
Active
Make sure this is set to Yes so your post type is registered and usable.
Labels
These are the texts that WordPress shows throughout the dashboard. For example:
Visibility Options
Control where your post type appears in the admin and site:
- Show in dashboard menu
- Show in admin bar
- Show in appearance menus
Menu Icon and Position
Choose an icon for your post type from the WordPress Dashicons set. Optionally, set its position in the sidebar.
Permalinks and URLs
You can define how URLs will look for your post type:
- Slug: A custom word for your URL (e.g.,
/movie/) - Enable archive and pagination
- Optionally include RSS feeds
Permissions
If needed, you can assign custom capabilities like edit_movie or delete_movies. Useful for advanced role control.
REST API Settings
Enable this if you plan to use the post type with the block editor or external tools.
- You can customize the API route, namespace, or controller class if needed.
4. Testing
Once everything is set up:
- Click Save to register your post type.
- Go to the WordPress dashboard menu where your new post type now appears.
- Click Add New and create a test entry.
- Visit your website and check that it appears correctly on the frontend.
Next Steps
- Add custom fields to your post type via Secure Custom Fields
- Configure how archives and single templates are displayed in your theme
- Set up or register your own taxonomies for more organization
For Developers
If you're a developer and prefer to register custom post types using code instead of the admin interface, you can refer to the official WordPress documentation:
How to Create Custom Post Types with Code
This guide includes examples and explanations on using register_post_type() and other related functions.
Creating Your First Taxonomy
A step-by-step guide to creating a custom taxonomy using Secure Custom Fields (SCF).
What is a taxonomy?
A taxonomy in WordPress is a way to group content together. The most common examples are categories and tags. You can create your own custom taxonomies to organize your content in meaningful ways depending on your needs—for example, genres for movies, colors for products, or locations for rentals.
Prerequisites
- SCF installed and activated
- Administrator access to WordPress
- Basic understanding of WordPress concepts
You can learn more about WordPress basics here:
1. Access the Admin Panel
To begin creating your custom taxonomy:
- Go to Secure Custom Fields → Taxonomies in your WordPress admin menu.
- Click the "Add New" button to open the creation form.
2. Basic Configuration
Plural Label *
Name shown in admin menus and listings, e.g., Genres.
Singular Label *
Used for individual terms. Example: Genre.
Taxonomy Key *
A unique identifier. Use lowercase letters, underscores, or dashes only. Max 32 characters. Example: genre.
Post Types
Select the post types that will use this taxonomy. For example, Posts, Pages, or custom types like product, vehicle, etc.
Public
Choose Yes to make the taxonomy visible on your website and in the admin dashboard.
Hierarchical
Enable to allow parent-child terms (like categories). Disable for flat lists (like tags).
Advanced Configuration
Enable this to unlock advanced settings for developers or experienced users.
3. Advanced Settings
Sort Terms
Controls whether the terms are stored in the order you assign them.
Default Term
Creates a default term that can’t be deleted, useful for fallback categorization.
Description
Brief summary of what the taxonomy represents.
Active
Make sure this is set to Yes so your taxonomy is usable.
Labels
Customize the texts shown in the WordPress admin:
Visibility Options
Control where the taxonomy appears in the admin and frontend:
- Show In UI, Show In Admin Menu
- Appearance Menu Support, Quick Edit, Admin Columns
Meta Box
Enable and configure how the taxonomy is displayed in the post editor. You can define custom callbacks for display and sanitization if needed.
Permalinks and URLs
Customize how your taxonomy URLs will be structured:
- Custom Slug, Include front prefix, Enable hierarchical URLs
- Publicly queryable, custom query variable
Permissions
Control who can manage, edit, assign, or delete terms.
You can set custom capabilities (e.g., manage_categories, edit_posts).
4. Testing
Once everything is configured:
- Click Save to register your taxonomy.
- Go to one of the selected post types (e.g., Posts or Products).
- Try adding terms in the new taxonomy field.
- Make sure they appear correctly in the editor and on the frontend if public.
For Developers
If you're a developer and prefer to register custom taxonomies using code instead of the admin interface, you can refer to the official WordPress documentation:
How to Create Custom Taxonomies with Code
This guide includes examples and explanations on using register_taxonomy() and other related functions.
Tutorials
Step-by-step guides for working with Secure Custom Fields.
Getting Started
- Creating Your First Post Type - Basic post type setup
- Field Group Basics - Creating and configuring field groups
- Working with Fields - Using different field types
Advanced Topics
- Custom Field Validation
- Complex Layouts with Flexible Content
- Advanced Post Type Configuration
- REST API Integration
Best Practices
Each tutorial follows these principles:
- Clear step-by-step instructions
- Practical examples
- Security considerations
- Performance optimization tips
Understanding the Relationship Between Post Types, Taxonomies, and Custom Fields
In WordPress, the true power of content modeling comes from combining Post Types, Taxonomies, and Custom Fields. Together, these tools allow you to build virtually any kind of data structure your website needs — from a real estate listing manager to a recipe library or an online product catalog.
This guide will help you understand how each element works, when to use them, and how they interact with each other in practical projects — using movies as our central example.
Prerequisites
- SCF (Secure Custom Fields) installed and activated
- Administrator access to WordPress
- Basic understanding of WordPress concepts
You can learn more about WordPress basics here:
1. Post Types
Post types define what kind of structured content you're managing in WordPress.
By default, WordPress includes two main types:
-
Posts:
These are time-based entries, perfect for blogs, news, or updates. Posts appear in your site's main feed and can be categorized or tagged. -
Pages:
These are static pieces of content like “About Us”, “Contact”, or “Terms of Service”. They are not organized by date and do not use categories or tags.
However, many websites require other types of content that don’t fit as a blog post or a static page. That’s where custom post types come in.
When should you create a custom post type?
- When your content doesn’t belong under regular posts or pages
- When you need a separate menu or editing interface in the admin panel
- When you’re managing structured content (with specific fields like images, dates, selections, etc.)
- When you want to keep things like
Movies,Products, orProjectsseparate from editorial content
Example: Movies
Let’s say you want to build a catalog of movies on your site.
Instead of creating a blog post for each movie, you can:
- Create a custom post type named
Movies. - Add fields like
Title,Director,Release Year,Poster Image. - Display them independently from blog posts or pages.
This gives you full control over how movies are created, organized, and displayed — without mixing them into your main blog.
2. Taxonomies
Taxonomies define how content is grouped. WordPress provides default taxonomies like Categories and Tags, but you can create your own — such as Genres, Years, or Directors.
When to create a custom taxonomy:
- You want to group or filter items based on shared traits
- You need hierarchical grouping (e.g., genre > sub-genre)
- You want users to navigate content by categories meaningful to them
Example (Movies):
Create a taxonomy called Genre and attach it to the Movie post type. This lets users filter all movies tagged as Action, Comedy, or Drama — and even group them by sub-genres if hierarchical.
3. Custom Fields
Custom fields store specific attributes that aren’t covered by the title or content fields. They are great for metadata that belongs to one item.
When to use custom fields:
- You want to add structured data to your post type (e.g., text, numbers, images)
- You want each item to have unique values (not shared or grouped like taxonomies)
Example (Movies):
Use custom fields to store each movie's Director, Release Year, Duration, Trailer URL, and Poster Image. These are all values unique to each movie and not ideal for filtering across many movies like taxonomies would be.
4. Why This Matters
When used together, these three features form a powerful content management structure. Here’s how it looks in practice for a movie website:
-
A Movie post type
-
With a Genre taxonomy (e.g., Action, Sci-Fi, Romance)
-
And custom fields for:
DirectorDurationRelease YearTrailer URL
This enables you to:
- Create a dedicated admin panel for movies
- Allow users to browse by genre
- Display rich details per movie on the frontend
- Build custom archive templates and filtering tools
Whether you're building a streaming catalog, a film festival archive, or a movie blog — combining post types, taxonomies, and custom fields allows WordPress to adapt far beyond traditional blogs.
Real-World Example: Real Estate Website
Post Type: Property
Each property is its own entry, allowing the team to manage listings independently.
Taxonomies:
Property Type(e.g., House, Apartment, Commercial)Location(e.g., City or Zone)
Custom Fields:
PriceBedroomsBathroomsSquare FootageGalleryContact Email
This setup allows site visitors to:
- Filter properties by type or location
- View detailed information per listing
- Submit inquiries directly from the property page
Real-World Example: User Check-In/Check-Out System
Post Type: User Visit
Each entry represents a single visit by a user.
Taxonomies:
Department(to group visits by area)
Custom Fields:
User NameCheck-In TimeCheck-Out TimePurpose of VisitApproved By
This setup enables admins to:
- Track entry and exit logs
- Generate visit reports by department
- Display current on-site users if needed
Advanced Example: Relational Content with Bidirectional Fields
In more complex systems, post types may need to relate to each other. You can use bidirectional relationships (also known as post-to-post relationships) to build powerful, interconnected structures.
Example: University Course Management System
Post Types:
CourseInstructorStudent
Taxonomies:
Department(e.g., Science, Arts)
Custom Fields:
-
Course:Course CodeCreditsInstructor(relationship to Instructor post)Enrolled Students(bidirectional relationship to Student posts)
-
Instructor:Full NameAssigned Courses(bidirectional relationship to Course posts)
-
Student:NameCourses Enrolled(bidirectional relationship to Course posts)
This setup enables features like:
- Displaying all students enrolled in a course
- Showing which instructor teaches each course
- Generating student dashboards with course schedules
You can manage this using Secure Custom Fields with relationship-type fields.
Next Steps
- Learn how to create your first custom post type
- Explore how to build a custom taxonomy
- Add and manage custom fields with SCF
Getting Started with Secure Custom Fields
This section helps you get up and running with Secure Custom Fields (SCF). Whether you're new to WordPress development or an experienced developer, these guides will help you start using SCF effectively.
In This Section
- Installation - How to install and activate SCF
- Quick Start - Create your first custom field group in minutes
- How Content Works - Understanding the Relationship Between Post Types, Taxonomies, and Custom Fields
Documentation Sections
- Concepts - Core concepts and architecture
- Features - Detailed feature documentation
- Tutorials - Step-by-step guides
- Contributing - How to contribute to SCF
Code Reference
The Code Reference provides detailed technical documentation of SCF's functions, classes, hooks, and APIs. This is particularly useful for developers who want to:
- Extend SCF's functionality
- Integrate SCF with other plugins or themes
- Understand SCF's internal architecture
- Find specific hooks and filters
Prerequisites
- WordPress 6.2 or later
- PHP 7.4 or later
- Basic understanding of WordPress development
Quick Start Guide
This guide will help you create your first custom field group with Secure Custom Fields.
Creating a Field Group
Example: Author Bio
Let's create a simple author bio field group:
- Create a new field group called "Author Profile"
- Add these fields:
- Profile Image (Image field)
- Bio (Textarea field)
- Social Links (Repeater field)
- Set location to "User Form"
- Save and test
Next Steps
- Learn about field types
- Explore advanced features
- Read the security guidelines