Secure Custom Fields 文档

Secure Custom Fields 文档,介绍字段组与安全相关用法。

Undocumented Code Elements

This file tracks code elements that need documentation.

Blocks/Bindings.php

Hooks

Datastore/Localization.php

Hooks

Datastore/REST_Save.php

Hooks

abilities/class-scf-field-abilities.php

Hooks

acf-bidirectional-functions.php

Hooks

acf-field-functions.php

Hooks

acf-field-group-functions.php

Hooks

acf-form-functions.php

Hooks

acf-helper-functions.php

Hooks

acf-internal-post-type-functions.php

Hooks

acf-meta-functions.php

Hooks

acf-user-functions.php

Hooks

acf-value-functions.php

Hooks

acf-wp-functions.php

Hooks

admin/admin-internal-post-type-list.php

Hooks

admin/admin-internal-post-type.php

Hooks

admin/admin-tools.php

Hooks

admin/admin.php

Hooks

admin/beta-features.php

Hooks

admin/class-acf-admin-options-page.php

Hooks

admin/post-types/admin-field-group.php

Hooks

admin/post-types/admin-field-groups.php

Hooks

admin/post-types/admin-post-type.php

Hooks

admin/post-types/admin-taxonomy.php

Hooks

admin/post-types/class-acf-admin-ui-options-page.php

Hooks

admin/views/acf-field-group/conditional-logic.php

Hooks

admin/views/acf-field-group/field.php

Hooks

admin/views/acf-field-group/fields.php

Hooks

admin/views/acf-field-group/options.php

Hooks

admin/views/acf-post-type/advanced-settings.php

Hooks

admin/views/acf-post-type/basic-settings.php

Hooks

admin/views/acf-taxonomy/basic-settings.php

Hooks

admin/views/acf-ui-options-page/basic-settings.php

Hooks

admin/views/acf-ui-options-page/create-options-page-modal.php

Hooks

admin/views/global/form-top.php

Hooks

admin/views/global/navigation.php

Hooks

ajax/class-acf-ajax-check-screen.php

Hooks

ajax/class-acf-ajax-query-users.php

Hooks

api/api-helpers.php

Functions

Hooks

api/api-template.php

Functions

Hooks

api/api-term.php

Hooks

assets.php

Hooks

blocks.php

Hooks

class-acf-options-page.php

Hooks

class-acf-site-health.php

Hooks

datastore.php

Hooks

fields.php

Hooks

fields/FlexibleContent/Layout.php

Hooks

fields/FlexibleContent/Render.php

Hooks

fields/class-acf-field-flexible-content.php

Hooks

fields/class-acf-field-gallery.php

Hooks

fields/class-acf-field-google-map.php

Hooks

fields/class-acf-field-icon_picker.php

Hooks

fields/class-acf-field-nav-menu.php

Hooks

fields/class-acf-field-oembed.php

Hooks

fields/class-acf-field-page_link.php

Hooks

fields/class-acf-field-post_object.php

Hooks

fields/class-acf-field-radio.php

Hooks

fields/class-acf-field-relationship.php

Hooks

fields/class-acf-field-select.php

Hooks

fields/class-acf-field-taxonomy.php

Hooks

fields/class-acf-field-user.php

Hooks

fields/class-acf-field-wysiwyg.php

Hooks

forms/WC_Order.php

Hooks

forms/form-front.php

Functions

Hooks

forms/form-post.php

Hooks

l10n.php

Hooks

local-json.php

Hooks

locations.php

Hooks

locations/class-acf-location-page-template.php

Hooks

locations/class-acf-location-post-template.php

Hooks

media.php

Hooks

post-types/class-acf-post-type.php

Hooks

post-types/class-acf-taxonomy.php

Hooks

post-types/class-acf-ui-options-page.php

Hooks

post-types/class-scf-field-manager.php

Hooks

rest-api/acf-rest-api-functions.php

Hooks

rest-api/class-acf-rest-api.php

Classes

Hooks

Methods

rest-api/class-acf-rest-embed-links.php

Methods

revisions.php

Hooks

upgrades.php

Hooks

validation.php

Hooks

Acf Bidirectional Functions Global Functions

acf_update_bidirectional_values()

Process updating bidirectional fields.

_scf_prepare_bidirectional_update()

Prepare a side-effect-free bidirectional update plan.

_scf_collect_bidirectional_destinations()

Collect the bidirectional destinations that a field update will write.

acf_get_valid_bidirectional_target_types()

Allows third party fields to enable support as a target field type for a particular object type

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

acf_build_bidirectional_relationship_field_target_args()

Build valid fields for a bidirectional relationship for select2 display

acf_render_bidirectional_field_settings()

Renders the field settings required for bidirectional fields

acf_get_bidirectional_field_settings_instruction_text()

Returns the translated instructional text for the message field for the bidirectional field settings.


Acf Field Functions Global Functions

acf_get_field()

acf_get_field

acf_get_raw_field()

acf_get_raw_field

acf_get_field_post()

acf_get_field_post

acf_is_field_key()

acf_is_field_key

acf_validate_field()

acf_validate_field

acf_get_valid_field()

acf_get_valid_field

acf_translate_field()

acf_translate_field

acf_get_fields()

acf_get_fields

acf_get_raw_fields()

acf_get_raw_fields

acf_get_field_count()

acf_get_field_count

acf_clone_field()

acf_clone_field

acf_prepare_field()

acf_prepare_field

acf_render_fields()

acf_render_fields

acf_render_field_wrap()

Render the wrapping element for a given field.

acf_render_field()

acf_render_field

acf_render_field_label()

acf_render_field_label

acf_get_field_label()

acf_get_field_label

acf_render_field_instructions()

Renders the field's instructions.

acf_render_field_setting()

acf_render_field_setting

acf_update_field()

acf_update_field

_acf_apply_unique_field_slug()

_acf_apply_unique_field_slug

acf_flush_field_cache()

acf_flush_field_cache

acf_delete_field()

acf_delete_field

acf_trash_field()

acf_trash_field

acf_untrash_field()

acf_untrash_field

_acf_untrash_field_post_status()

Filter callback which returns the previous post_status instead of "draft" for the "acf-field" post type.

acf_prefix_fields()

acf_prefix_fields

acf_get_sub_field()

acf_get_sub_field

acf_search_fields()

acf_search_fields

acf_is_field()

acf_is_field

acf_get_field_ancestors()

acf_get_field_ancestors

acf_duplicate_fields()

acf_duplicate_fields

acf_duplicate_field()

acf_duplicate_field

acf_prepare_fields_for_export()

acf_prepare_fields_for_export

acf_prepare_field_for_export()

acf_prepare_field_for_export

acf_prepare_fields_for_import()

acf_prepare_field_for_import

acf_prepare_field_for_import()

acf_prepare_field_for_import

acf_get_field_json_schema()

Retrieves the JSON schema for a field.


Acf Field Group Functions Global Functions

acf_get_field_group()

acf_get_field_group

acf_get_raw_field_group()

acf_get_raw_field_group

acf_get_field_group_post()

acf_get_field_group_post

acf_is_field_group_key()

acf_is_field_group_key

acf_validate_field_group()

Ensures the given field group is valid.

acf_get_valid_field_group()

acf_get_valid_field_group

acf_translate_field_group()

acf_translate_field_group

acf_get_field_groups()

acf_get_field_groups

acf_get_raw_field_groups()

acf_get_raw_field_groups

acf_filter_field_groups()

acf_filter_field_groups

acf_get_field_group_visibility()

acf_get_field_group_visibility

acf_update_field_group()

acf_update_field_group

_acf_apply_unique_field_group_slug()

_acf_apply_unique_field_group_slug

acf_flush_field_group_cache()

acf_flush_field_group_cache

acf_delete_field_group()

acf_delete_field_group

acf_trash_field_group()

acf_trash_field_group

acf_untrash_field_group()

acf_untrash_field_group

_acf_untrash_field_group_post_status()

Filter callback which returns the previous post_status instead of "draft" for the "acf-field-group" post type.

acf_is_field_group()

acf_is_field_group

acf_duplicate_field_group()

acf_duplicate_field_group

acf_update_field_group_active_status()

Activates or deactivates a field group.

acf_get_field_group_style()

acf_get_field_group_style

acf_get_field_group_edit_link()

acf_get_field_group_edit_link

acf_prepare_field_group_for_export()

acf_prepare_field_group_for_export

acf_prepare_field_group_for_import()

acf_prepare_field_group_for_import

acf_import_field_group()

acf_import_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.

acf_field_group_has_location_type()

Checks if a field group has the provided location rule.

acf_get_field_group_title()

Retrieves the field group title, or display title if set.


Acf Form Functions Global Functions

acf_set_form_data()

acf_set_form_data

acf_get_form_data()

acf_get_form_data

acf_form_data()

acf_form_data

acf_save_post()

acf_save_post

_acf_do_save_post()

_acf_do_save_post


Acf Helper Functions Global Functions

acf_is_empty()

Returns true if the value provided is considered "empty". Allows numbers such as 0.

acf_not_empty()

Returns true if the value provided is considered "not empty". Allows numbers such as 0.

acf_uniqid()

Returns a unique numeric based id.

acf_merge_attributes()

Merges together two arrays but with extra functionality to append class names.

acf_cache_key()

acf_cache_key

acf_request_args()

acf_request_args

acf_request_arg()

Returns a single $_REQUEST arg with fallback.

acf_enable_filter()

acf_enable_filter

acf_disable_filter()

acf_disable_filter

acf_is_filter_enabled()

acf_is_filter_enabled

acf_get_filters()

acf_get_filters

acf_set_filters()

acf_set_filters

acf_disable_filters()

acf_disable_filters

acf_enable_filters()

acf_enable_filters

acf_idval()

acf_idval

acf_maybe_idval()

acf_maybe_idval

acf_format_numerics()

Convert any numeric strings into their equivalent numeric type. This function will work with both single values and arrays.

acf_numval()

acf_numval

acf_idify()

acf_idify

acf_slugify()

Returns a slug friendly string.

acf_punctify()

Returns a string with correct full stop punctuation.

acf_did()

acf_did

acf_strlen()

Returns the length of a string that has been submitted via $_POST.

  1. Unslash the string because posted values will be slashed.
  2. Decode special characters because wp_kses() will normalize entities.
  3. Treat line-breaks as a single character instead of two.
  4. Use mb_strlen() to accommodate special characters.

acf_with_default()

Returns a value with default fallback.

acf_doing_action()

Returns the current priority of a running action.

acf_get_current_url()

Returns the current URL.

acf_sanitize_request_args()

Sanitizes request arguments.

acf_sanitize_files_array()

Sanitizes file upload arrays.

acf_sanitize_files_value_array()

Sanitizes file upload values within the array.

acf_maybe_unserialize()

Maybe unserialize, but don't allow any classes.

acf_is_beta()

Check if ACF is a beta-like 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.


Acf Hook Functions Global Functions

acf_add_filter_variations()

acf_add_filter_variations

acf_add_action_variations()

acf_add_action_variations

_acf_apply_hook_variations()

_acf_apply_hook_variations

acf_add_deprecated_filter()

acf_add_deprecated_filter

acf_add_deprecated_action()

acf_add_deprecated_action

_acf_apply_deprecated_hook()

Applies a deprecated filter during apply_filters() or do_action().


Acf Input Functions Global Functions

acf_filter_attrs()

acf_filter_attrs

acf_esc_attrs()

acf_esc_attrs

acf_esc_html()

Sanitizes text content and strips out disallowed HTML.

_acf_kses_allowed_html()

Private callback for the "wp_kses_allowed_html" filter used to return allowed HTML for "acf" context.

acf_hidden_input()

acf_hidden_input

acf_get_hidden_input()

acf_get_hidden_input

acf_text_input()

acf_text_input

acf_get_text_input()

acf_get_text_input

acf_file_input()

acf_file_input

acf_get_file_input()

acf_get_file_input

acf_textarea_input()

acf_textarea_input

acf_get_textarea_input()

acf_get_textarea_input

acf_checkbox_input()

acf_checkbox_input

acf_get_checkbox_input()

acf_get_checkbox_input

acf_radio_input()

acf_radio_input

acf_get_radio_input()

acf_get_radio_input

acf_select_input()

acf_select_input

acf_get_select_input()

acf_select_input

acf_walk_select_input()

acf_walk_select_input

acf_clean_atts()

acf_clean_atts

acf_esc_atts()

acf_esc_atts

acf_esc_attr()

acf_esc_attr

acf_esc_attr_e()

acf_esc_attr_e

acf_esc_atts_e()

acf_esc_atts_e


Acf Internal Post Type Functions Global Functions

acf_get_internal_post_type_instance()

Gets an instance of an ACF_Internal_Post_Type.

acf_get_internal_post_type()

Get an ACF CPT object as an array

acf_get_raw_internal_post_type()

Retrieves raw internal post type data for the given identifier.

acf_get_internal_post_type_post()

Gets a post object from an ACF internal post type.

acf_is_internal_post_type_key()

Returns true if the given identifier is a ACF internal post type key.

acf_validate_internal_post_type()

Validates an ACF internal post type.

acf_translate_internal_post_type()

Translates the settings for an ACF internal post type.

acf_get_internal_post_type_posts()

Returns and array of ACF posts for the given $filter.

acf_get_raw_internal_post_type_posts()

Returns an array of raw/unvalidated ACF post data.

acf_filter_internal_post_type_posts()

Returns a filtered array of ACF posts based on the given $args.

acf_update_internal_post_type()

Updates a internal post type in the database.

acf_flush_internal_post_type_cache()

Deletes all caches for the provided ACF post.

acf_delete_internal_post_type()

Deletes an internal post type from the database.

acf_trash_internal_post_type()

Trashes an internal post type.

acf_untrash_internal_post_type()

Restores an ACF post from the trash.

acf_is_internal_post_type()

Returns true if the given params match an ACF post.

acf_duplicate_internal_post_type()

Duplicates an ACF post.

acf_update_internal_post_type_active_status()

Activates or deactivates an ACF post.

acf_get_internal_post_type_edit_link()

Checks if the current user can edit the field group and returns the edit url.

acf_prepare_internal_post_type_for_export()

Returns a modified field group ready for export.

acf_export_internal_post_type_as_php()

Exports an ACF post as PHP.

acf_prepare_internal_post_type_for_import()

Prepares an ACF post for the import process.

acf_import_internal_post_type()

Imports an ACF post into the database.

acf_determine_internal_post_type()

Tries to determine the ACF post type for the provided key.

acf_is_valid_internal_post_type_key()

Check if the provided key is an identifiable ACF post type.

acf_internal_post_object_contains_valid_key()

Check if the provided post type object contains a valid internal post type key.

acf_get_combined_post_type_settings_tabs()

Returns an array of tabs for the post type advanced settings.

acf_get_combined_taxonomy_settings_tabs()

Returns an array of tabs for the taxonomy advanced settings.

acf_get_combined_options_page_settings_tabs()

Returns an array of tabs for the options page advanced settings

acf_get_post_type_from_screen_value()

Converts an _acf_screen or hook value into a post type.

acf_validate_internal_post_type_values()

Calls the ajax validator for a post type

acf_add_internal_post_type_validation_error()

Adds a validation error for ACF internal post types.

acf_get_post_type_from_request_args()

Gets an ACF post type from request args and verifies nonce based on action.

acf_get_taxonomy_from_request_args()

Gets an ACF taxonomy from request args and verifies nonce based on action.

acf_get_ui_options_page_from_request_args()

Gets an ACF options page from request args and verifies nonce based on action.


Acf Meta Functions Global Functions

acf_get_meta()

Returns an array of "ACF only" meta for the given post_id.

acf_get_option_meta()

acf_get_option_meta

acf_get_metadata()

Retrieves specific metadata from the database.

acf_update_metadata()

Updates metadata in the database.

acf_delete_metadata()

Deletes metadata from the database.

acf_copy_metadata()

Copies meta from one post to another. Useful for saving and restoring revisions.

acf_copy_postmeta()

acf_copy_postmeta

acf_get_meta_field()

acf_get_meta_field

acf_get_metaref()

acf_get_metaref

acf_update_metaref()

acf_update_metaref

acf_get_meta_instance()

Retrieves an ACF meta instance for the provided meta type.

acf_get_metadata_by_field()

Gets metadata from the database.

acf_update_metadata_by_field()

Updates metadata in the database.

acf_delete_metadata_by_field()

Deletes metadata from the database.


Acf Post Functions Global Functions

acf_get_post_templates()

Returns available templates for each post type.


Acf Post Type Functions Global Functions

acf_get_post_type()

Get an ACF CPT as an array

acf_get_raw_post_type()

Retrieves a raw ACF CPT.

acf_get_post_type_post()

Gets a post object for an ACF CPT.

acf_is_post_type_key()

Returns true if the given identifier is an ACF CPT key.

acf_validate_post_type()

Validates an ACF CPT.

acf_translate_post_type()

Translates the settings for an ACF internal post type.

acf_get_acf_post_types()

Returns and array of ACF post types for the given $filter.

acf_get_raw_post_types()

Returns an array of raw ACF post types.

acf_filter_post_types()

Returns a filtered array of ACF post types based on the given $args.

acf_update_post_type()

Updates an ACF post type in the database.

acf_flush_post_type_cache()

Deletes all caches for the provided ACF post type.

acf_delete_post_type()

Deletes an ACF post type from the database.

acf_trash_post_type()

Trashes an ACF post type.

acf_untrash_post_type()

Restores an ACF post type from the trash.

acf_is_post_type()

Returns true if the given params match an ACF post type.

acf_duplicate_post_type()

Duplicates an ACF post type.

acf_update_post_type_active_status()

Activates or deactivates an ACF post type.

acf_get_post_type_edit_link()

Checks if the current user can edit the post type and returns the edit url.

acf_prepare_post_type_for_export()

Returns a modified ACF post type ready for export.

acf_export_post_type_as_php()

Exports an ACF post type as PHP.

acf_prepare_post_type_for_import()

Prepares an ACF post type for the import process.

acf_import_post_type()

Imports an ACF post type into the database.

acf_export_enter_title_here()

Exports the "Enter Title Here" text for the provided ACF post types.


Acf Taxonomy Functions Global Functions

acf_get_taxonomy()

Get an ACF taxonomy as an array

acf_get_raw_taxonomy()

Retrieves a raw ACF taxonomy.

acf_get_taxonomy_post()

Gets a post object for an ACF taxonomy.

acf_is_taxonomy_key()

Returns true if the given identifier is an ACF taxonomy key.

acf_validate_taxonomy()

Validates an ACF taxonomy.

acf_translate_taxonomy()

Translates the settings for an ACF taxonomy.

acf_get_acf_taxonomies()

Returns an array of ACF taxonomies for the given $filter.

acf_get_raw_taxonomies()

Returns an array of raw ACF taxonomies.

acf_filter_taxonomies()

Returns a filtered array of ACF taxonomies based on the given $args.

acf_update_taxonomy()

Updates an ACF taxonomy in the database.

acf_flush_taxonomy_cache()

Deletes all caches for the provided ACF taxonomy.

acf_delete_taxonomy()

Deletes an ACF taxonomy from the database.

acf_trash_taxonomy()

Trashes an ACF taxonomy.

acf_untrash_taxonomy()

Restores an ACF taxonomy from the trash.

acf_is_taxonomy()

Returns true if the given params match an ACF taxonomy.

acf_duplicate_taxonomy()

Duplicates an ACF taxonomy.

acf_update_taxonomy_active_status()

Activates or deactivates an ACF taxonomy.

acf_get_taxonomy_edit_link()

Checks if the current user can edit the taxonomy and returns the edit url.

acf_prepare_taxonomy_for_export()

Returns a modified ACF taxonomy ready for export.

acf_export_taxonomy_as_php()

Exports an ACF taxonomy as PHP.

acf_prepare_taxonomy_for_import()

Prepares an ACF taxonomy for the import process.

acf_import_taxonomy()

Imports an ACF taxonomy into the database.


Acf User Functions Global Functions

acf_get_users()

acf_get_users

acf_get_user_result()

acf_get_user_result

acf_get_user_role_labels()

acf_get_user_role_labels

acf_allow_unfiltered_html()

Returns true if the current user is allowed to save unfiltered HTML.


Acf Utility Functions Global Functions

acf_new_instance()

acf_new_instance

acf_get_instance()

Returns an instance for the given class.

acf_register_store()

acf_register_store

acf_get_store()

acf_get_store

acf_switch_stores()

acf_switch_stores

acf_get_path()

acf_get_path

acf_get_url()

acf_get_url

acf_include()

Includes a file within the ACF plugin.


Acf Value Functions Global Functions

acf_get_reference()

acf_get_reference

acf_get_value()

Retrieves the value for a given field and post_id.

acf_format_value()

Returns a formatted version of the provided value.

acf_update_value()

acf_update_value

acf_update_values()

acf_update_values

acf_flush_value_cache()

acf_flush_value_cache

acf_delete_value()

acf_delete_value

acf_preview_value()

acf_preview_value

acf_log_invalid_field_notice()

Potentially log an error if a field doesn't exist when we expect it to.


Acf Wp Functions Global Functions

acf_get_object_type()

Returns a WordPress object type.

acf_decode_post_id()

Decodes a post_id value such as 1 or "user_1" into an array containing the type and ID.

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.

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.


Assets Global Functions

acf_localize_text()

Appends an array of i18n data for localization.

acf_localize_data()

Appends an array of l10n data for localization.

acf_enqueue_script()

Enqueues a script with support for supplemental inline scripts.

acf_enqueue_scripts()

Enqueues the input scripts required for fields.

acf_enqueue_uploader()

Enqueues the WP media uploader scripts and styles.


Blocks Global Functions

acf_add_block_namespace()

Prefix block names for SCF blocks registered through block.json

acf_handle_json_block_registration()

Handle an SCF block registered through block.json

acf_is_acf_block_json()

Check if a block.json block is an SCF block.

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.

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().

acf_register_block_type()

Registers a block type.

acf_register_block()

See acf_register_block_type().

acf_has_block_type()

Returns true if a block type exists for the given name.

acf_get_block_types()

Returns an array of all registered block types.

acf_get_block_type()

Returns a block type for the given name.

acf_remove_block_type()

Removes a block type for the given name.

acf_get_block_type_default_attributes()

Returns an array of default attribute settings for a block type.

acf_validate_block_type()

Validates a block type ensuring all settings exist.

acf_prepare_block()

Prepares a block for use in render_callback by merging in all settings and attributes.

acf_add_back_compat_attributes()

Add backwards compatible attribute values.

acf_get_block_back_compat_attribute_key_array()

Get back compat new values and old values.

acf_render_block_callback()

The render callback for all ACF blocks.

acf_rendered_block()

Returns the rendered block HTML.

acf_rendered_block_v3()

Returns the rendered block HTML for v3 blocks.

acf_replace_inner_blocks_in_block_content()

Replaces InnerBlocks strings in a block with the inner block content.

acf_render_block()

Renders the block HTML.

scf_path_has_stream_wrapper()

Checks if a path uses a PHP stream wrapper, such as phar:// or php://.

acf_block_render_template()

Locate and include an ACF block's template.

acf_get_block_fields()

Returns an array of all fields for the given block.

acf_enqueue_block_assets()

Enqueues and localizes block scripts and styles.

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.

acf_enqueue_block_type_assets()

Enqueues scripts and styles for a specific block type.

acf_ajax_fetch_block()

Handles the ajax request for block data.

acf_get_empty_block_form_html()

Render the empty block form for when a block has no fields assigned.

acf_parse_save_blocks()

Parse content that may contain HTML block comments and saves ACF block meta.

acf_parse_save_blocks_callback()

Callback used in preg_replace to modify ACF Block comment.

acf_get_block_id()

Return or generate a block ID.

acf_ensure_block_id_prefix()

Ensure a block ID always has a block_ prefix for post meta internals.

acf_serialize_block_attributes()

This directly copied from the WordPress core serialize_block_attributes() function.

acf_get_block_validation_state()

Handle validating a block's fields and return the validity, and any errors.

acf_validate_block_from_post_data()

Handle the specific validation for a block from POSTed values.

acf_validate_block_from_local_meta()

Handle the specific validation for a block from local meta.

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.

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.

acf_block_uses_post_meta()

Checks if the provided block is configured to save/load post meta.

acf_add_block_meta_values()

Loads ACF field values from the post meta if the block is configured to do so.

acf_save_block_meta_values()

Stores ACF field values in post meta for any blocks configured to do so.

acf_get_block_meta_values_to_save()

Iterates over blocks in post content and retrieves values that need to be saved to post meta.

acf_inline_toolbar_editing_attrs()

Helper function that returns the HTML attributes required for toolbar inline editing as a string or array.

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.

acf_process_block_toolbar_fields()

This function prepares a fields array for being localized and used on the frontend as block toolbar fields.

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.


Compatibility Global Functions

acf_get_compatibility()

Returns true if compatibility is enabled for the given component.


Datastore Global Functions

acf_is_using_datastore()

Whether the SCF datastore is enabled.


Deprecated Global Functions

acf_render_field_wrap_label()

acf_render_field_wrap_label

acf_render_field_wrap_description()

acf_render_field_wrap_description

acf_get_fields_by_id()

Returns and array of fields for the given $parent_id.

acf_update_option()

acf_update_option

acf_get_field_reference()

acf_get_field_reference

acf_get_dir()

acf_get_dir


Fields Global Functions

acf_register_field_type()

alias of acf()->fields->register_field_type()

acf_register_field_type_info()

alias of acf()->fields->register_field_type_info()

acf_get_field_type()

alias of acf()->fields->get_field_type()

acf_get_field_types()

alias of acf()->fields->get_field_types()

acf_get_field_types_info()

acf_get_field_types_info

acf_is_field_type()

alias of acf()->fields->is_field_type()

acf_get_field_type_prop()

This function will return a field type's property

acf_get_field_type_label()

This function will return the label of a field type

acf_field_type_supports()

Returns the value of a field type "supports" property.

acf_field_type_exists()

acf_get_field_categories_i18n()

Returns an array of localised field categories.

acf_get_grouped_field_types()

Returns an multi-dimensional array of field types "name => label" grouped by category

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.

acf_get_pro_field_types()

Get the PRO only fields and their core metadata.


Code Reference

Files

L10n Global Functions

acf_get_locale()

Returns the current locale.

acf_load_textdomain()

acf_load_textdomain

_acf_apply_language_cache_key()

_acf_apply_language_cache_key


Local Fields Global Functions

acf_enable_local()

acf_enable_local

acf_disable_local()

acf_disable_local

acf_is_local_enabled()

acf_is_local_enabled

acf_get_local_store()

Returns either local store or a dummy store for the given name or post type.

acf_reset_local()

acf_reset_local

acf_get_local_field_groups()

acf_get_local_field_groups

acf_get_local_internal_posts()

Returns local ACF posts with the provided post type.

acf_have_local_field_groups()

acf_have_local_field_groups

acf_count_local_field_groups()

acf_count_local_field_groups

acf_add_local_field_group()

acf_add_local_field_group

acf_add_local_internal_post_type()

Adds a local ACF internal post type.

register_field_group()

register_field_group

acf_remove_local_field_group()

acf_remove_local_field_group

acf_remove_local_internal_post_type()

Removes a local ACF post with the given key and post type.

acf_is_local_field_group()

acf_is_local_field_group

acf_is_local_internal_post_type()

Returns true if an ACF post exists for the given key.

acf_is_local_field_group_key()

acf_is_local_field_group_key

acf_is_local_internal_post_type_key()

Returns true if a local ACF post exists for the given key.

acf_get_local_field_group()

acf_get_local_field_group

acf_get_local_internal_post_type()

Returns an ACF post for the given key.

acf_add_local_fields()

acf_add_local_fields

acf_get_local_fields()

acf_get_local_fields

acf_have_local_fields()

acf_have_local_fields

acf_count_local_fields()

acf_count_local_fields

acf_add_local_field()

acf_add_local_field

_acf_generate_local_key()

_acf_generate_local_key

acf_remove_local_field()

acf_remove_local_field

acf_is_local_field()

acf_is_local_field

acf_is_local_field_key()

acf_is_local_field_key

acf_get_local_field()

acf_get_local_field

_acf_apply_get_local_field_groups()

_acf_apply_get_local_field_groups

_acf_apply_get_local_internal_posts()

Appends local ACF internal post types to the provided array.

_acf_apply_is_local_field_key()

_acf_apply_is_local_field_key

_acf_apply_is_local_field_group_key()

_acf_apply_is_local_field_group_key

_acf_apply_is_local_internal_post_type_key()

Returns true if is a local key.

_acf_do_prepare_local_fields()

_acf_do_prepare_local_fields


Local Json Global Functions

acf_get_local_json_files()

Returns an array of found JSON field group files.

acf_write_json_field_group()

Saves a field group JSON file.

acf_delete_json_field_group()

Deletes a field group JSON file.


Local Meta Global Functions

acf_setup_meta()

acf_setup_meta

acf_reset_meta()

acf_reset_meta


Locations Global Functions

acf_register_location_type()

Registers a location type.

acf_get_location_types()

Returns an array of all registered location types.

acf_get_location_type()

Returns a location type for the given name.

acf_get_location_rule_types()

Returns a grouped array of all location rule types.

acf_validate_location_rule()

Returns a validated location rule with all props.

acf_get_location_rule_operators()

Returns an array of operators for a given rule.

acf_get_location_rule_values()

Returns an array of values for a given rule.

acf_match_location_rule()

Returns true if the provided rule matches the screen args.

acf_get_location_screen()

Returns ann array of screen args to be used against matching rules.

acf_register_location_rule()

Alias of acf_register_location_type().

acf_get_location_rule()

Alias of acf_get_location_type().

acf_get_valid_location_rule()

Alias of acf_validate_location_rule().


Loop Global Functions

acf_add_loop()

alias of acf()->loop->add_loop()

acf_update_loop()

alias of acf()->loop->update_loop()

acf_get_loop()

alias of acf()->loop->get_loop()

acf_remove_loop()

alias of acf()->loop->remove_loop()


Revisions Global Functions

acf_save_post_revision()

This function will copy meta from a post to it's latest revision

acf_get_post_latest_revision()

This function will return the latest revision for a given post


Scf Ui Options Page Functions Global Functions

acf_get_ui_options_page()

Get an SCF UI options page as an array

acf_get_raw_ui_options_page()

Retrieves a raw SCF UI options page.

acf_get_ui_options_page_post()

Gets a post object for an SCF UI options page.

acf_is_ui_options_page_key()

Returns true if the given identifier is an SCF UI options page key.

acf_validate_ui_options_page()

Validates an SCF UI options page.

acf_translate_ui_options_page()

Translates the settings for an SCF UI options page.

acf_get_ui_options_pages()

Returns and array of SCF UI options pages for the given $filter.

acf_get_raw_ui_options_pages()

Returns an array of raw SCF UI options pages.

acf_filter_ui_options_pages()

Returns a filtered array of SCF UI options pages based on the given $args.

acf_update_ui_options_page()

Updates an SCF UI options page in the database.

acf_flush_ui_options_page_cache()

Deletes all caches for the provided ACF UI options page.

acf_delete_ui_options_page()

Deletes an ACF UI options page from the database.

acf_trash_ui_options_page()

Trashes an ACF UI options page.

acf_untrash_ui_options_page()

Restores an ACF UI options page from the trash.

acf_is_ui_options_page()

Returns true if the given params match an ACF UI options page.

acf_duplicate_ui_options_page()

Duplicates an ACF UI options page.

acf_update_ui_options_page_active_status()

Activates or deactivates an ACF UI options page.

acf_get_ui_options_page_edit_link()

Checks if the current user can edit the UI options page and returns the edit URL.

acf_prepare_ui_options_page_for_export()

Returns a modified ACF UI options page ready for export.

acf_export_ui_options_page_as_php()

Exports an ACF UI options page as PHP.

acf_prepare_ui_options_page_for_import()

Prepares an ACF UI options page for the import process.

acf_import_ui_options_page()

Imports an ACF UI options page into the database.


Upgrades Global Functions

acf_has_upgrade()

acf_has_upgrade

acf_upgrade_all()

Runs upgrade routines if this site has an upgrade available.

acf_get_db_version()

acf_get_db_version

acf_update_db_version()

Updates the ACF DB version.

acf_upgrade_500()

acf_upgrade_500

acf_upgrade_500_field_groups()

acf_upgrade_500_field_groups

acf_upgrade_500_field_group()

acf_upgrade_500_field_group

acf_upgrade_500_fields()

acf_upgrade_500_fields

acf_upgrade_500_field()

acf_upgrade_500_field

acf_upgrade_550()

acf_upgrade_550

acf_upgrade_550_termmeta()

acf_upgrade_550_termmeta

acf_wp_upgrade_550_termmeta()

When the database is updated to support term meta, migrate ACF term meta data across.

acf_upgrade_550_taxonomy()

acf_upgrade_550_taxonomy


Validation Global Functions

acf_add_validation_error()

Add validation error.

acf_get_validation_errors()

Retrieve validation errors.

acf_get_validation_error()

Get the validation error.

acf_reset_validation_errors()

Reset Validation errors.

acf_validate_save_post()

This function will validate $_POST data and add errors

acf_validate_values()

This function will validate an array of field values

acf_validate_value()

This function will validate a field's value


Admin Commands Global Functions

acf_commands_init()

Initializes SCF commands integration

  1. Only loads in screens where WordPress commands are available.
  2. Performs capability checks to ensure users only see commands they can access.
  3. Core administrative commands are only shown to users with SCF admin capabilities.
  4. Custom post type commands are conditionally shown based on edit_posts capability for each specific post type.
  5. Post types must have UI enabled (show_ui setting) to appear in commands.

Admin Notices Global Functions

acf_new_admin_notice()

Instantiates and returns a new model.

acf_render_admin_notices()

Renders all admin notices HTML.

acf_add_admin_notice()

Creates and returns a new notice.


Admin Tools Global Functions

acf_register_admin_tool()

Alias of acf()->admin_tools->register_tool()

acf_get_admin_tools_url()

acf_get_admin_tool_url()

This function will return the admin URL to the tools page


Beta Features Global Functions

scf_register_admin_beta_feature()

Alias of acf()->admin_beta_features->register_beta_feature()

scf_get_admin_beta_features_url()

This function will return the admin 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.


API Helpers Global Functions

acf_is_array()

This function will return true for a non empty array

acf_has_setting()

Alias of acf()->has_setting()

acf_raw_setting()

acf_raw_setting

acf_update_setting()

acf_update_setting

acf_validate_setting()

acf_validate_setting

acf_get_setting()

Alias of acf()->get_setting()

acf_is_pro()

Returns whether the current plugin load is running with PRO features enabled.

acf_get_internal_post_types()

Return an array of ACF's internal post type names

acf_append_setting()

acf_append_setting

acf_get_data()

acf_get_data

acf_set_data()

acf_set_data

acf_append_data()

Appends data to an existing key.

acf_init()

Alias of acf()->init() - the core ACF init function.

acf_has_done()

acf_has_done

acf_get_external_path()

This function will return the path to a file within an external folder

acf_get_external_dir()

This function will return the url to a file within an internal ACF folder

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).

acf_parse_args()

This function will merge together 2 arrays and also convert any numeric values to ints

acf_parse_types()

acf_parse_types

acf_parse_type()

acf_parse_type

acf_get_view()

This function will load in a file from the 'admin/views' folder and allow variables to be passed through

acf_merge_atts()

acf_merge_atts

acf_nonce_input()

This function will create and echo a basic nonce input

acf_extract_var()

This function will remove the var from the array, and return the var

acf_extract_vars()

This function will remove the vars from the array, and return the vars

acf_get_sub_array()

acf_get_sub_array

acf_get_post_types()

Returns an array of post type names.

acf_get_post_stati()

Function acf_get_post_stati()

acf_get_pretty_post_statuses()

Function acf_get_pretty_post_statuses()

acf_get_post_type_label()

acf_get_post_type_label

acf_get_post_status_label()

Function acf_get_post_status_label()

acf_verify_nonce()

acf_verify_nonce

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

acf_get_image_sizes()

acf_get_image_sizes

acf_version_compare()

acf_version_compare

acf_get_full_version()

acf_get_full_version

acf_get_terms()

acf_get_terms

acf_get_taxonomy_terms()

acf_get_taxonomy_terms

acf_decode_taxonomy_terms()

acf_decode_taxonomy_terms

acf_decode_taxonomy_term()

acf_decode_taxonomy_term

acf_array()

acf_array

acf_unarray()

Returns a non-array value.

acf_get_array()

acf_get_array

acf_get_numeric()

acf_get_numeric

acf_get_posts()

acf_get_posts

_acf_query_remove_post_type()

_acf_query_remove_post_type

acf_get_grouped_posts()

acf_get_grouped_posts

_acf_orderby_post_type()

The internal ACF function to add order by post types for use in acf_get_grouped_posts

acf_get_pretty_user_roles()

acf_get_pretty_user_roles

acf_get_grouped_users()

acf_get_grouped_users

acf_json_encode()

acf_json_encode

acf_str_exists()

acf_str_exists

acf_debug()

A legacy function designed for developer debugging.

acf_debug_start()

A legacy function designed for developer debugging.

acf_debug_end()

A legacy function designed for developer debugging.

acf_encode_choices()

acf_encode_choices

acf_str_replace()

acf_str_replace

acf_split_date_time()

acf_split_date_time

acf_convert_date_to_php()

acf_convert_date_to_php

acf_convert_date_to_js()

acf_convert_date_to_js

acf_convert_time_to_php()

acf_convert_time_to_php

acf_convert_time_to_js()

acf_convert_time_to_js

acf_update_user_setting()

acf_update_user_setting

acf_get_user_setting()

acf_get_user_setting

acf_in_array()

acf_in_array

acf_get_valid_post_id()

acf_get_valid_post_id

acf_get_post_id_info()

acf_get_post_id_info

acf_isset_termmeta()

acf_isset_termmeta

acf_upload_files()

This function will walk through the $_FILES data and upload each found.

acf_upload_file()

acf_upload_file

acf_update_nested_array()

acf_update_nested_array

acf_is_screen()

acf_is_screen

acf_is_acf_admin_screen()

Check if we're in an ACF admin screen

acf_maybe_get()

acf_maybe_get

acf_get_attachment()

Returns an array of attachment data.

acf_get_truncated()

This function will truncate and return a string

acf_current_user_can_admin()

acf_current_user_can_admin

scf_current_user_has_capability()

Checks if the current user has the SCF capability for programmatic access, without considering show_admin setting.

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+.

acf_current_user_can_edit_post()

Wrapper function for current_user_can( 'edit_post', $post_id ).

acf_current_user_can_edit_in_context()

Checks if the current user can edit a given ACF context.

acf_get_filesize()

acf_get_filesize

acf_format_filesize()

acf_format_filesize

acf_get_valid_terms()

acf_get_valid_terms

acf_validate_attachment()

acf_validate_attachment

acf_translate()

acf_translate

acf_maybe_add_action()

acf_maybe_add_action

acf_is_row_collapsed()

acf_is_row_collapsed

acf_get_attachment_image()

Return an image tag for the provided attachment ID

acf_get_post_thumbnail()

acf_get_post_thumbnail

acf_get_browser()

acf_get_browser

acf_is_ajax()

acf_is_ajax

acf_format_date()

Returns a date value in a formatted string.

acf_clear_log()

Previously, deletes the debug.log file.

acf_log()

acf_log

acf_dev_log()

acf_dev_log

acf_doing()

acf_doing

acf_is_doing()

acf_is_doing

acf_is_plugin_active()

acf_is_plugin_active

acf_send_ajax_results()

acf_send_ajax_results

acf_is_sequential_array()

acf_is_sequential_array

acf_is_associative_array()

acf_is_associative_array

acf_add_array_key_prefix()

acf_add_array_key_prefix

acf_remove_array_key_prefix()

acf_remove_array_key_prefix

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

acf_encrypt()

acf_encrypt

acf_decrypt()

Decrypts an encrypted string using PHP. https://bhoover.com/using-php-openssl_encrypt-openssl_decrypt-encrypt-decrypt-data/

acf_parse_markdown()

acf_parse_markdown

acf_get_sites()

acf_get_sites

acf_convert_rules_to_groups()

acf_convert_rules_to_groups

acf_register_ajax()

acf_register_ajax

acf_str_camel_case()

acf_str_camel_case

acf_array_camel_case()

acf_array_camel_case

acf_is_block_editor()

Returns true if the current screen is using the block editor.

acf_get_wp_reserved_terms()

Return an array of the WordPress reserved terms

acf_is_multisite_sub_site()

Detect if we're on a multisite subsite.

acf_is_multisite_main_site()

Detect if we're on a multisite 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

the_field()

This function is the same as echo get_field(), but will escape the value for safe HTML output regardless of parameters.

_acf_log_escaped_html()

Logs instances of ACF successfully escaping unsafe HTML.

_acf_get_escaped_html_log()

Returns an array of instances where HTML was altered due to escaping in the_field or a shortcode.

_acf_update_escaped_html_log()

Updates the array of instances where HTML was altered due to escaping in the_field or a shortcode.

_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.

get_field_object()

This function will return an array containing all the field data for a given field_name.

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

acf_maybe_get_sub_field()

This function will attempt to find a sub field

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.

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.

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.

the_row()

This function will progress the global repeater or flexible content value 1 row

get_row_sub_field()

This function is used inside a 'has_sub_field' while loop to return a sub field object

get_row_sub_value()

This function is used inside a 'has_sub_field' while loop to return a sub field value

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

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

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

the_sub_field()

This function is the same as echo get_sub_field(), but will escape the value for safe HTML output.

get_sub_field_object()

This function is used inside a 'has_sub_field' while loop to return a sub field object

get_row_layout()

This function will return a string representation of the current row layout within a 'have_rows' loop

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"]

update_field()

This function will update a value in the database

update_sub_field()

This function will update a value of a sub field in the database

delete_field()

This function will remove a value from the database

delete_sub_field()

This function will delete a value of a sub field in the database

add_row()

This function will add a row of data to a field

add_sub_row()

This function will add a row of data to a field

update_row()

This function will update a row of data to a field

update_sub_row()

This function will add a row of data to a field

delete_row()

This function will delete a row of data from a field

delete_sub_row()

This function will add a row of data to a field

create_field()

Deprecated Functions


API Term Global Functions

acf_get_taxonomies()

Returns an array of taxonomy names.

acf_get_taxonomies_for_post_type()

acf_get_taxonomies_for_post_type

acf_get_taxonomy_labels()

Returns an array of taxonomies in the format "name => label" for use in a select field.

acf_get_term_title()

acf_get_term_title

acf_get_grouped_terms()

acf_get_grouped_terms

_acf_terms_clauses()

_acf_terms_clauses

acf_get_pretty_taxonomies()

acf_get_pretty_taxonomies

acf_get_term()

acf_get_term

acf_encode_term()

acf_encode_term

acf_decode_term()

acf_decode_term

acf_get_encoded_terms()

acf_get_encoded_terms

acf_get_choices_from_terms()

acf_get_choices_from_terms

acf_get_choices_from_grouped_terms()

acf_get_choices_from_grouped_terms

acf_get_choice_from_term()

acf_get_choice_from_term

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.


Api

Files

ACF_Repeater_Table

ACF_Repeater_Table

Properties

$field

The main field array used to render the repeater.

$sub_fields

An array containing the subfields used in the repeater.

$value

The value(s) of the repeater field.

$show_add

If we should show the "Add Row" button.

$show_remove

If we should show the "Remove Row" button.

$show_order

If we should show the order of the fields.

Methods

__construct

Constructs the ACF_Repeater_Table class.

setup

Sets up the field for rendering.

prepare_value

Prepares the repeater values for rendering.

render

Renders the full repeater table.

thead

Renders the table head.

rows

Renders or returns rows for the repeater field table.

row

Renders an individual row.

row_handle

Renders the row handle at the start of each row.

row_actions

Renders the actions displayed at the end of each row.

table_actions

Renders the actions displayed underneath the table.

pagination

Renders the table pagination. Mostly lifted from the WordPress core WP_List_Table class.

Fields

Files

Form Front Global Functions

acf_form_head()

Functions


Forms

Files

Hooks

Files

Acf Rest API Functions Global Functions

acf_get_field_rest_schema()

Get the REST API schema for a given field.

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.

scf_rest_sanitize_user_sub_fields()

Replaces User subfield data with REST-safe values.

scf_rest_sanitize_user_data()

Replaces formatted User field data with REST-safe values based on the field definition.

scf_rest_format_standard_value()

Applies standard field formatting while keeping User values safe for REST output.

acf_format_value_for_rest()

Format a given field's value for output in the REST API.


ACF_Rest_Api

Properties

$request

$rest_update_plan

Fields and updates resolved during the current REST request.

Methods

register_field

Register our custom property as a REST field.

get_schema

Dynamically generate the schema for the current request.

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.

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.

check_bidirectional_target_permissions

Check bidirectional target permissions before the REST callback runs.

prepare_field_updates

Resolve incoming values against fields active for the REST object.

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.

make_identifier

Make the ACF identifier string for the given object.

object_type_has_field_group

Gets an array of the location types that a field group is configured to use.

get_field_groups_by_object_type

Get all field groups for the provided object type.

get_field_groups_by_id

Get all field groups for a given object.

get_fields

Get all ACF fields for a given field group and allow third party filtering.

ACF_Rest_Embed_Links

Class ACF_Rest_Embed_Links

Properties

Methods

Hook into all REST-enabled post type, taxonomy, and the user controllers in order to prepare links.

Hook into the rest_prepare_{$type} filters and add links for the object being prepared.

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();

$http_method

$current_route

$supported_routes

$url_params

$object_type

$object_sub_type

$child_object_type

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.

get_url_param

Get a URL parameter if found on the request URL.

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.

get_taxonomy_by_rest_base

Find the REST enabled taxonomy object that matches the given REST base.

SCF_Rest_Types_Endpoint

Class SCF_Rest_Types_Endpoint

Methods

__construct

Initialize the class and register hooks.

is_valid_source

Validate source parameter.

request_has_permission

Checks whether the matched REST route permits the request.

filter_types_request

Filter post types requests for individual post type requests.

filter_post_type

Filter individual post type in the response.

get_source_post_types

Get post types for a specific source.

register_extra_fields

Register extra SCF fields for the post types endpoint.

get_scf_fields

Get SCF fields for a post type.

get_scf_post_id

Get the SCF internal post ID for a post type.

get_field_schema

Get the schema for the SCF fields.

register_parameters

Register the source parameter for the post types endpoint.

get_source_param_definition

Get the source parameter definition

add_parameter_to_endpoints

Add source parameter directly to the endpoints for proper documentation

add_collection_params

Add source parameter to the collection parameters for the types endpoint.

clean_types_response

Clean up null entries from the response

REST API

Files

Architecture

This document explains the internal architecture of Secure Custom Fields.

Core Components

1. Field Management System

2. Post Type Management

3. Security Layer

Plugin Structure

The plugin is organized into several key directories:

Core Directories

Directory Responsibilities

  1. includes/

    • Core plugin functionality
    • Field type handling
    • Post type management
    • API endpoints
  2. fields/

    • Individual field type classes
    • Field validation logic
    • Field rendering code
    • Field storage handling
  3. admin/

    • Admin interface components
    • Settings pages
    • Field group management
    • Post type configuration
  4. api/

    • Public API endpoints
    • Integration points
    • External access methods

Loading Process

1. Plugin Initialization

2. WordPress Integration

3. Feature Registration

4. Admin Interface Setup

Data Flow

  1. Input Processing

    • Form submission
    • API requests
    • AJAX calls
  2. Data Validation

    • Type checking
    • Format validation
    • Security verification
  3. Storage

    • WordPress post meta
    • Custom tables
    • Caching
  4. 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

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

Feature Categories

  1. Content Management

    • Custom post types
    • Custom taxonomies
    • Field groups
  2. Field Types

    • Basic fields (text, textarea, etc.)
    • Advanced fields (repeater, flexible content)
    • Special fields (relationship, clone)
  3. Developer Tools

    • API endpoints
    • Hooks and filters
    • Helper functions

Available Fields

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:

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:

  1. Navigate to Custom Fields → Post Types
  2. Click "Add New"
  3. Configure basic settings
  4. Save and publish

Advanced Configuration

Best Practices

  1. Choose descriptive post type names
  2. Configure proper labels for better UX
  3. Plan taxonomy relationships
  4. Consider permalink structure
  5. Set appropriate capabilities

Examples

Common use cases for custom post types:

API Reference

The Secure Custom Fields API provides programmatic access to field data and plugin functionality.

Core Functions

Field Operations

Post Type Management

Integration Points

  1. WordPress Core

    • Post type registration
    • Taxonomy integration
    • Capability handling
  2. Theme Integration

    • Template functions
    • Conditional tags
    • Layout helpers
  3. Plugin Compatibility

    • REST API support
    • Cache integration
    • Query modifications

Best Practices

  1. Always sanitize input
  2. Validate data types
  3. Use proper escaping
  4. Check capabilities
  5. 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:

Adding New Field Documentation

  1. Create a new directory for the field type
  2. Create both required files
  3. Follow the standard format for each file type
  4. 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 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

Settings

Using the Accordion Field

Basic Setup

  1. Create a new Field Group
  2. Add an Accordion field
  3. 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

  1. Organizing Content Sections

    • Group related fields together
    • Use clear section names
    • Consider the editing workflow
  2. Creating Form Sections

    • Basic Information
    • Detailed Content
    • Settings/Configuration

Tips

Button Group Field

The Button Group field provides a set of buttons where users can select one option from multiple choices. It offers a more visual and user-friendly alternative to radio buttons or select dropdowns.

Key Features

Settings

Using the Button Group Field

Basic Setup

  1. Create a new Field Group
  2. Add a Button Group field
  3. Configure the choices:
    • Add value:label pairs
    • Set a default value
    • Choose return format

Common Use Cases

  1. Simple Toggle Options

    • Yes/No choices
    • Show/Hide settings
    • Layout selections
  2. Status Selection

    • Draft/Review/Published
    • Active/Inactive
    • Priority levels

Tips

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

Settings

Using the Checkbox Field

Basic Setup

  1. Create a new Field Group
  2. Add a Checkbox field
  3. Configure options:
    • Add checkbox choices
    • Set layout (vertical/horizontal)
    • Choose return format
    • Enable/disable "Select All"

Common Use Cases

  1. Multiple Selection Lists

    • Categories/Tags
    • Feature toggles
    • Permission settings
  2. 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

Settings

Using the Clone Field

Basic Setup

  1. Create a new Field Group
  2. Add a Clone field
  3. Configure clone settings:
    • Select fields/groups to clone
    • Choose display format
    • Set prefix options
    • Configure labels

Common Use Cases

  1. Reusable Field Sets

    • Contact information
    • Social media links
    • Common metadata
  2. Template Components

    • Shared content blocks
    • Repeated field patterns
    • Standard form elements

Tips

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

Settings

Using the Color Picker Field

Basic Setup

  1. Create a new Field Group
  2. Add a Color Picker field
  3. Configure options:
    • Set default color
    • Enable/disable opacity
    • Choose return format
    • Set display preferences

Common Use Cases

  1. Theme Customization

    • Brand colors
    • Background colors
    • Text colors
  2. Design Elements

    • Button colors
    • Border colors
    • Overlay settings

Tips

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

Settings

Using the Date Picker Field

Basic Setup

  1. Create a new Field Group
  2. Add a Date Picker field
  3. Configure options:
    • Set display format
    • Choose return format
    • Configure week start day
    • Set default value

Common Use Cases

  1. Event Management

    • Event dates
    • Scheduling
    • Deadlines
  2. Content Planning

    • Publication dates
    • Campaign scheduling
    • Time-sensitive content

Tips

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

Settings

Using the Date Time Picker Field

Basic Setup

  1. Create a new Field Group
  2. Add a Date Time Picker field
  3. Configure options:
    • Set display format
    • Choose return format
    • Set time increment
    • Configure default value

Common Use Cases

  1. Event Scheduling

    • Event start/end times
    • Appointment booking
    • Session timing
  2. Content Scheduling

    • Post scheduling
    • Time-based features
    • Automated tasks

Tips

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

Settings

Using the Email Field

Basic Setup

  1. Create a new Field Group
  2. Add an Email field
  3. Configure options:
    • Set placeholder text
    • Add prepend/append text
    • Configure validation
    • Set default value

Common Use Cases

  1. Contact Information

    • Contact forms
    • User profiles
    • Directory listings
  2. Notification Settings

    • Alert recipients
    • Newsletter subscriptions
    • System notifications

Tips

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

Settings

Using the File Field

Basic Setup

  1. Create a new Field Group
  2. Add a File field
  3. Configure options:
    • Set allowed file types
    • Configure size limits
    • Choose library restriction
    • Set return format

Common Use Cases

  1. Document Management

    • PDF uploads
    • Document attachments
    • Resource libraries
  2. Media Handling

    • Download files
    • Asset management
    • Resource linking

Tips

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

Settings

Using the Flexible Content Field

Basic Setup

  1. Create a new Field Group
  2. Add a Flexible Content field
  3. Configure layouts:
    • Create layout types
    • Add fields to each layout
    • Set minimum/maximum
    • Configure button labels

Common Use Cases

  1. Page Building

    • Content sections
    • Landing pages
    • Dynamic layouts
  2. Content Management

    • Article components
    • Product displays
    • Feature blocks

Tips

Gallery Field

Key Features

Settings

Using the Gallery Field

Basic Setup

  1. Create a new Field Group
  2. Add a Gallery field
  3. Configure options:
    • Set image restrictions
    • Choose preview size
    • Configure min/max images
    • Set insert position

Common Use Cases

  1. Image Collections

    • Photo galleries
    • Product images
    • Portfolio displays
  2. Media Management

    • Slideshows
    • Image grids
    • Media libraries

Tips

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

Settings

Using the Google Map Field

Basic Setup

  1. Create a new Field Group
  2. Add a Google Map field
  3. Configure options:
    • Set default center point
    • Configure zoom level
    • Set map height
    • Choose display format

Common Use Cases

  1. Location Information

    • Business locations
    • Event venues
    • Contact pages
  2. Geographic Data

    • Service areas
    • Delivery zones
    • Store locators

Tips

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

Settings

Using the Group Field

Basic Setup

  1. Create a new Field Group
  2. Add a Group field
  3. Configure sub-fields:
    • Add desired fields
    • Arrange field layout
    • Set labels
    • Choose return format

Common Use Cases

Tips

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

Settings

Using the Icon Picker Field

Basic Setup

  1. Create a new Field Group
  2. Add an Icon Picker field
  3. Configure options:
    • Select icon libraries
    • Set preview size
    • Configure return format
    • Enable custom URLs

Common Use Cases

  1. UI Elements

    • Menu icons
    • Feature indicators
    • Button symbols
  2. Visual Content

    • Social media icons
    • Category markers
    • Navigation elements

Tips

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

Settings

Using the Image Field

Basic Setup

  1. Create a new Field Group
  2. Add an Image field
  3. Configure options:
    • Set preview size
    • Choose library type
    • Configure size limits
    • Set return format

Common Use Cases

  1. Content Images

    • Featured images
    • Article photos
    • Profile pictures
  2. Design Elements

    • Background images
    • Logo uploads
    • Banner images

Tips

Link Field

Key Features

Settings

Using the Link Field

Basic Setup

  1. Create a new Field Group
  2. Add a Link field
  3. Configure options:
    • Choose return format
    • Set default value
    • Configure display
    • Enable/disable features

Common Use Cases

  1. Navigation Elements

    • Menu links
    • Call-to-actions
    • Resource links
  2. Content References

    • Related content
    • External resources
    • Document links

Tips

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

Settings

Using the Message Field

Basic Setup

  1. Create a new Field Group
  2. Add a Message field
  3. Configure options:
    • Enter message content
    • Set formatting options
    • Configure HTML handling
    • Choose display style

Common Use Cases

  1. User Guidance

    • Field instructions
    • Section descriptions
    • Important notices
  2. Content Organization

    • Section dividers
    • Group headers
    • Information blocks

Tips

Nav Menu Field

The Nav Menu Field field provides a way to select nav menus and output them.

Key Features

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.

  1. Go to Custom Fields > Add New in your WordPress admin panel.
  2. 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.

  1. Click Add Field within the field group.
  2. Set the Field Type to Nav Menu.
  3. 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.

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

  1. 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

Settings

Using the Number Field

Basic Setup

  1. Create a new Field Group
  2. Add a Number field
  3. Configure options:
    • Set min/max values
    • Configure step size
    • Add placeholder text
    • Set default value

Common Use Cases

  1. Numeric Input

    • Quantities
    • Ratings
    • Measurements
  2. Settings Control

    • Display options
    • Configuration values
    • Numeric parameters

Tips

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

Settings

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

  1. Create a new Field Group
  2. Add an oEmbed field
  3. Configure options:
    • Set width/height
    • Configure preview
    • Set display options
    • Choose providers

Common Use Cases

  1. Media Integration

    • Video embeds
    • Social media posts
    • Audio content
  2. External Content

    • YouTube videos
    • Twitter posts
    • Spotify tracks

Tips

Page Link Field

Key Features

Settings

Using the Page Link Field

Basic Setup

  1. Create a new Field Group
  2. Add a Page Link field
  3. Configure options:
    • Select post types
    • Configure taxonomy filters
    • Set multiple selection
    • Enable/disable archives

Common Use Cases

  1. Internal Navigation

    • Related content
    • Section links
    • Menu structures
  2. Content Relationships

    • Related posts
    • Resource links
    • Content hierarchy

Tips

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

Settings

Using the Password Field

Basic Setup

  1. Create a new Field Group
  2. Add a Password field
  3. Configure options:
    • Set placeholder text
    • Add prepend/append
    • Configure validation
    • Set character limits

Common Use Cases

  1. Security Settings

    • API keys
    • Access tokens
    • Private credentials
  2. User Management

    • Password fields
    • Security questions
    • Access codes

Tips

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

Settings

Using the Post Object Field

Basic Setup

  1. Create a new Field Group
  2. Add a Post Object field
  3. Configure options:
    • Select post types
    • Set taxonomy filters
    • Configure multiple selection
    • Choose return format

Common Use Cases

  1. Content Relationships

    • Related posts
    • Parent/child content
    • Cross-references
  2. Content Selection

    • Featured content
    • Resource lists
    • Content linking

Tips

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

Settings

Using the Radio Field

Basic Setup

  1. Create a new Field Group
  2. Add a Radio field
  3. Configure options:
    • Add choice options
    • Set layout format
    • Configure default value
    • Enable/disable features

Common Use Cases

  1. Single Choice Selection

    • Status options
    • Display preferences
    • Content types
  2. Configuration Options

    • Layout choices
    • Setting selections
    • Display modes

Tips

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

Settings

Using the Range Field

Basic Setup

  1. Create a new Field Group
  2. Add a Range field
  3. Configure options:
    • Set min/max values
    • Configure step size
    • Add prepend/append text
    • Set default value

Common Use Cases

  1. Numeric Ranges

    • Volume controls
    • Percentage settings
    • Scale selections
  2. Visual Settings

    • Opacity levels
    • Size adjustments
    • Intensity controls

Tips

Repeater Field

The Repeater field allows you to create a set of sub fields which can be repeated again and again.

Key Features

Settings

Using the Repeater Field

Basic Setup

  1. Create a new Field Group
  2. Add a Repeater field
  3. Configure options:
    • Add sub fields
    • Set min/max rows
    • Choose layout style
    • Configure labels

Common Use Cases

  1. Dynamic Content

    • Social media links
    • Team members
    • Feature lists
  2. Content Management

    • Gallery items
    • Related links
    • Service offerings

Tips

Select Field

The Select field provides a dropdown interface for selecting single or multiple options from a predefined list.

Key Features

Settings

Using the Select Field

Basic Setup

  1. Create a new Field Group
  2. Add a Select field
  3. Configure options:
    • Add choice options
    • Set default value
    • Configure UI settings
    • Enable/disable features

Common Use Cases

  1. Option Selection

    • Status choices
    • Category selection
    • Preference settings
  2. Data Filtering

    • View options
    • Content filtering
    • Display settings

Tips

Separator Field

The Separator field provides visual separation between fields in the editing interface. It helps organize and structure field layouts.

Key Features

Settings

Using the Separator Field

Basic Setup

  1. Create a new Field Group
  2. Add a Separator field
  3. Configure options:
    • Set label text
    • Add instructions
    • Style wrapper
    • Position field

Common Use Cases

  1. Content Organization

    • Section breaks
    • Field grouping
    • Visual hierarchy
  2. Form Structure

    • Content sections
    • Logical breaks
    • Visual spacing

Tips

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

Settings

Using the Tab Field

Basic Setup

  1. Create a new Field Group
  2. Add a Tab field
  3. Configure options:
    • Set tab label
    • Choose placement
    • Set endpoint
    • Add instructions

Common Use Cases

  1. Content Organization

    • Content sections
    • Settings groups
    • Form organization
  2. Interface Design

    • Complex forms
    • Settings panels
    • Data grouping

Tips

Taxonomy Field

The Taxonomy field creates an interface for selecting taxonomy terms. It supports multiple selection methods and term management.

Key Features

Settings

Using the Taxonomy Field

Basic Setup

  1. Create a new Field Group
  2. Add a Taxonomy field
  3. Configure options:
    • Select taxonomy
    • Choose field type
    • Set load behavior
    • Configure saving

Common Use Cases

  1. Content Classification

    • Categories
    • Tags
    • Custom taxonomies
  2. Term Management

    • Content organization
    • Filtering systems
    • Related content

Tips

Text Field

The Text field provides a standard single-line text input with various formatting and validation options.

Key Features

Settings

Using the Text Field

Basic Setup

  1. Create a new Field Group
  2. Add a Text field
  3. Configure options:
    • Set placeholder
    • Add character limits
    • Configure formatting
    • Set default value

Common Use Cases

  1. Basic Information

    • Titles
    • Names
    • Short descriptions
    • References
  2. Form Elements

    • Input fields
    • Search boxes
    • Labels
    • Identifiers

Tips

Textarea Field

The Textarea field provides a multi-line text input for longer content with formatting options and character limits.

Key Features

Settings

Using the Textarea Field

Basic Setup

  1. Create a new Field Group
  2. Add a Textarea field
  3. Configure options:
    • Set rows
    • Add placeholder
    • Configure limits
    • Set line handling

Common Use Cases

  1. Long Text Content

    • Descriptions
    • Biographies
    • Instructions
    • Notes
  2. Content Management

    • Excerpts
    • Summaries
    • Meta descriptions
    • Comments

Tips

Time Picker Field

The Time Picker field provides an interface for selecting time values with customizable display and increment options.

Key Features

Settings

Using the Time Picker Field

Basic Setup

  1. Create a new Field Group
  2. Add a Time Picker field
  3. Configure options:
    • Set time format
    • Choose increment
    • Set default time
    • Configure display

Common Use Cases

  1. Schedule Management

    • Event times
    • Opening hours
    • Appointment slots
  2. Time Settings

    • Scheduling
    • Time restrictions
    • Operating hours

Tips

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

Settings

Using the True/False Field

Basic Setup

  1. Create a new Field Group
  2. Add a True/False field
  3. Configure options:
    • Set message
    • Choose default
    • Configure labels
    • Style interface

Common Use Cases

  1. Simple Toggles

    • Feature flags
    • Display options
    • Status switches
  2. Settings Control

    • Visibility settings
    • Enable/disable
    • Option toggles

Tips

URL Field

The URL field provides input for web addresses with validation and formatting options. It ensures proper URL format and structure.

Key Features

Settings

Using the URL Field

Basic Setup

  1. Create a new Field Group
  2. Add a URL field
  3. Configure options:
    • Set placeholder
    • Configure protocol
    • Set validation
    • Choose format

Common Use Cases

Tips

User Field

The User field creates an interface for selecting WordPress users. It supports multiple selection methods and user filtering.

Key Features

Settings

Using the User Field

Basic Setup

  1. Create a new Field Group
  2. Add a User field
  3. Configure options:
    • Select roles
    • Set return format
    • Configure multiple
    • Set filters

Common Use Cases

  1. User Assignment

    • Author selection
    • Team members
    • User permissions
  2. User Relations

    • Content ownership
    • User groups
    • Access control

Tips

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

Settings

Using the WYSIWYG Field

Basic Setup

  1. Create a new Field Group
  2. Add a WYSIWYG field
  3. Configure options:
    • Choose toolbar
    • Set media options
    • Configure height
    • Set defaults

Common Use Cases

  1. Rich Content

    • Post content
    • Product descriptions
    • Page sections
  2. Formatted Text

    • Documentation
    • Guidelines
    • Formatted messages

Tips

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

You can learn more about WordPress basics here:

1. Access the Admin Panel

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:

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:

📌 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:


Validation Settings

Used to restrict and control the kind of data that can be entered:


Presentation Settings

Controls the visual appearance of the field in the editor:


Conditional Logic

Used to show or hide fields based on the value of other fields:


⚠️ 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:


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:

  1. Create an options page named theme_options.
  2. Add a text field called phone_number.
  3. 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

You can learn more about WordPress basics here:

1. Access the Admin Panel

2. Basic Configuration

Set up the following fields to define the behavior and placement of your options page:

Basic Settings Panel

Advanced Settings Panel

Visibility

Description

Labels

Permissions

Data Storage

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

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:

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

You can learn more about WordPress basics here:

1. Access the Admin Panel

To begin creating your custom post type:

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:

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:

Menu Icon and Position

Choose an icon for your post type from the WordPress Dashicons set. Optionally, set its position in the sidebar.

You can define how URLs will look for your post type:

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.

4. Testing

Once everything is set up:

Next Steps

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

You can learn more about WordPress basics here:

1. Access the Admin Panel

To begin creating your custom taxonomy:

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:

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.

Customize how your taxonomy URLs will be structured:

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:

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

Advanced Topics

Best Practices

Each tutorial follows these principles:

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

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:

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?


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:

  1. Create a custom post type named Movies.
  2. Add fields like Title, Director, Release Year, Poster Image.
  3. 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:

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:

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:

This enables you to:

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:

Custom Fields:

This setup allows site visitors to:


Real-World Example: User Check-In/Check-Out System

Post Type: User Visit

Each entry represents a single visit by a user.

Taxonomies:

Custom Fields:

This setup enables admins to:

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:

Taxonomies:

Custom Fields:

This setup enables features like:

You can manage this using Secure Custom Fields with relationship-type fields.


Next Steps

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

Documentation Sections

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:

Prerequisites

Quick Start Guide

This guide will help you create your first custom field group with Secure Custom Fields.

Creating a Field Group

  1. Navigate to Custom Fields → Add New
  2. Enter a title for your field group
  3. Click "Add Field"
  4. Choose a field type
  5. Configure the field settings
  6. Set the location rules
  7. Save the field group

Example: Author Bio

Let's create a simple author bio field group:

  1. Create a new field group called "Author Profile"
  2. Add these fields:
    • Profile Image (Image field)
    • Bio (Textarea field)
    • Social Links (Repeater field)
  3. Set location to "User Form"
  4. Save and test

Next Steps