### Setup npm and Composer Dependencies Source: https://github.com/wordpress/secure-custom-fields/blob/trunk/AGENTS.md Installs project dependencies using npm and composer. Always check wp-env status before starting. ```bash npm install && composer install ``` -------------------------------- ### Install Dependencies and Build Plugin Source: https://github.com/wordpress/secure-custom-fields/blob/trunk/docs/contributing/index.md Run these commands to install project dependencies and build the plugin's JavaScript and CSS files from source. Use `npm run watch` for continuous rebuilding during development. ```sh npm install composer install npm run build ``` -------------------------------- ### Manage wp-env Status and Start Source: https://github.com/wordpress/secure-custom-fields/blob/trunk/AGENTS.md Checks the status of the wp-env development environment and starts it if necessary. Use 'wp-env start' only when the environment is not already running. ```bash npm run wp-env status # Always check status first ``` ```bash npm run wp-env start # Only start if not already running ``` -------------------------------- ### Install Composer Dependencies Source: https://github.com/wordpress/secure-custom-fields/blob/trunk/docs/welcome/installation.md Run this command in your terminal after updating your composer.json to install Secure Custom Fields and other project dependencies. ```shell composer install ``` ```shell composer i ``` -------------------------------- ### acf_switch_stores() Source: https://github.com/wordpress/secure-custom-fields/blob/trunk/docs/code-reference/acf-utility-functions-file.md Triggered when switching between sites on a multisite installation. ```APIDOC ## acf_switch_stores() ### Description Triggered when switching between sites on a multisite installation. ### Parameters #### Path Parameters - **site_id** (integer) - Required - New blog ID. - **prev_blog_id** (integer) - Required - Prev blog ID. ### Returns - void ``` -------------------------------- ### Create Distribution Zip Source: https://github.com/wordpress/secure-custom-fields/blob/trunk/docs/contributing/index.md Execute this script to generate a distribution zip file for the plugin, similar to the one published on WordPress.org. It verifies required files, installs production dependencies, and creates the zip in the `release/` directory. ```sh ./bin/create-release-zip.sh ``` -------------------------------- ### Composer Configuration for SCF Source: https://github.com/wordpress/secure-custom-fields/blob/trunk/docs/welcome/installation.md Add this JSON configuration to your composer.json file to include Secure Custom Fields as a dependency. This sets up the repository, defines installation paths, and requires the plugin. ```json { "repositories": [ { "type": "composer", "url": "https://wpackagist.org" } ], "extra": { "installer-paths": { "vendor/{$name}/": ["type:wordpress-plugin"] } }, "require": { "wpackagist-plugin/secure-custom-fields": "^6.4" }, "config": { "allow-plugins": { "composer/installers": true } } } ``` -------------------------------- ### acf_get_ui_options_page_post() Source: https://github.com/wordpress/secure-custom-fields/blob/trunk/docs/code-reference/scf-ui-options-page-functions-file.md Gets the post object associated with an SCF UI options page. ```APIDOC ## acf_get_ui_options_page_post() ### Description Gets a post object for an SCF UI options page. ### Parameters #### Path Parameters - **id** (integer|string) - Required - The post ID, key, or name. ### Returns - object|boolean - The post object, or false on failure. ``` -------------------------------- ### acf_get_ui_options_page_from_request_args() Source: https://github.com/wordpress/secure-custom-fields/blob/trunk/docs/code-reference/acf-internal-post-type-functions-file.md Gets an ACF options page from request arguments and verifies the nonce based on the provided action. This function is available from ACF version 6.2. ```APIDOC ## `acf_get_ui_options_page_from_request_args()` ### Description Gets an ACF options page from request arguments and verifies nonce based on action. ### Parameters #### Path Parameters - `action` (string) - The action being performed. ### Returns - `array|boolean` - Returns an array representing the options page or a boolean indicating failure. ``` -------------------------------- ### acf_is_beta() Source: https://github.com/wordpress/secure-custom-fields/blob/trunk/docs/code-reference/acf-helper-functions-file.md Determines if the currently installed version of ACF is a beta, alpha, or release candidate version. ```APIDOC ## `acf_is_beta()` Check if ACF is a beta-like release. * @since ACF 6.3 * @return boolean True if the current install version contains a dash, indicating a alpha, beta or RC release. ``` -------------------------------- ### Add Custom Menu Container Tags Source: https://github.com/wordpress/secure-custom-fields/blob/trunk/docs/features/field/nav_menu/tutorial.md This example shows how to extend the allowed HTML container tags for the Nav Menu field using the `wp_nav_menu_container_allowed_tags` filter. This allows for more flexibility in wrapping the navigation menu. ```php ``` -------------------------------- ### acf_get_taxonomy_from_request_args() Source: https://github.com/wordpress/secure-custom-fields/blob/trunk/docs/code-reference/acf-internal-post-type-functions-file.md Gets an ACF taxonomy from request arguments and verifies the nonce based on the provided action. This function is available from ACF version 6.1.5. ```APIDOC ## `acf_get_taxonomy_from_request_args()` ### Description Gets an ACF taxonomy from request arguments and verifies nonce based on action. ### Parameters #### Path Parameters - `action` (string) - The action being performed. ### Returns - `array|boolean` - Returns an array representing the taxonomy or a boolean indicating failure. ``` -------------------------------- ### Prepare Release Branch and Run Script Source: https://github.com/wordpress/secure-custom-fields/blob/trunk/docs/contributing/releases.md Create a new branch from trunk, pull the latest changes, and run the prepare-release script to build assets, generate documentation, and update version information. ```sh git checkout trunk && git pull git checkout -b release/x.y.z composer prepare-release ``` -------------------------------- ### Development and Build Commands Source: https://github.com/wordpress/secure-custom-fields/blob/trunk/AGENTS.md Commands for running development tasks with watch mode or creating a production build. ```bash npm run watch # Development with watch ``` ```bash npm run build # Production build ``` -------------------------------- ### acf_get_locale() Source: https://github.com/wordpress/secure-custom-fields/blob/trunk/docs/code-reference/l10n-file.md Retrieves the current locale set for the WordPress installation. ```APIDOC ## `acf_get_locale()` ### Description Returns the current locale. ### Returns * string - The current locale. ``` -------------------------------- ### acf_prepare_ui_options_page_for_import() Source: https://github.com/wordpress/secure-custom-fields/blob/trunk/docs/code-reference/scf-ui-options-page-functions-file.md Prepares an SCF UI options page array for the import process. ```APIDOC ## acf_prepare_ui_options_page_for_import() ### Description Prepares an ACF UI options page for the import process. ### Parameters #### Path Parameters - **ui_options_page** (array) - Required - The ACF UI options page array. ### Returns - array - The prepared UI options page array for import. ``` -------------------------------- ### acf_get_taxonomy_post() Source: https://github.com/wordpress/secure-custom-fields/blob/trunk/docs/code-reference/acf-taxonomy-functions-file.md Gets the post object associated with an ACF taxonomy. ```APIDOC ## acf_get_taxonomy_post() ### Description Gets a post object for an ACF taxonomy. ### Parameters #### Path Parameters - **id** (integer|string) - Required - The post ID, key, or name. ### Returns - **object|boolean** - The post object, or false on failure. ``` -------------------------------- ### acf_setup_meta() Source: https://github.com/wordpress/secure-custom-fields/blob/trunk/docs/code-reference/local-meta-file.md Adds post meta to storage. This function is used to prepare post meta data for processing. ```APIDOC ## `acf_setup_meta()` ### Description Adds postmeta to storage. ### Method N/A (Global Function) ### Parameters N/A (See ACF_Local_Meta::add() for details) ### Response Returns an array containing the post meta data. ``` -------------------------------- ### acf_get_valid_location_rule() Source: https://github.com/wordpress/secure-custom-fields/blob/trunk/docs/code-reference/locations-file.md An alias for `acf_validate_location_rule()`, used to get a validated location rule. ```APIDOC ## acf_get_valid_location_rule() ### Description Alias of acf_validate_location_rule(). ### Parameters #### Path Parameters - **rule** (array) - Required - The location rule. ### Return - array: The validated location rule. ``` -------------------------------- ### acf_prepare_ui_options_page_for_export() Source: https://github.com/wordpress/secure-custom-fields/blob/trunk/docs/code-reference/scf-ui-options-page-functions-file.md Prepares an SCF UI options page array for export. ```APIDOC ## acf_prepare_ui_options_page_for_export() ### Description Returns a modified ACF UI options page ready for export. ### Parameters #### Path Parameters - **ui_options_page** (array) - Required - The ACF UI options page array. ### Returns - array - The prepared UI options page array for export. ``` -------------------------------- ### acf_is_multisite_sub_site() Source: https://github.com/wordpress/secure-custom-fields/blob/trunk/docs/code-reference/api/api-helpers-file.md Detects if the current context is a subsite within a WordPress multisite installation. ```APIDOC ## `acf_is_multisite_sub_site()` Detect if we're on a multisite subsite. ### Returns - boolean - True if we're in a multisite install and not on the main site, false otherwise. ``` -------------------------------- ### Run PHPUnit Tests in Directory Source: https://github.com/wordpress/secure-custom-fields/blob/trunk/AGENTS.md Executes PHPUnit tests for all files within a specified directory. Requires wp-env to be running. ```bash vendor/bin/phpunit / # Directory ``` -------------------------------- ### acf_is_multisite_main_site() Source: https://github.com/wordpress/secure-custom-fields/blob/trunk/docs/code-reference/api/api-helpers-file.md Detects if the current context is the main site within a WordPress multisite installation. ```APIDOC ## `acf_is_multisite_main_site()` Detect if we're on a multisite main site. ### Returns - boolean - True if we're in a multisite install and on the main site, false otherwise. ``` -------------------------------- ### Checkout SVN Repository Source: https://github.com/wordpress/secure-custom-fields/blob/trunk/docs/contributing/releases.md Use this command to check out the SVN repository for the secure-custom-fields plugin into a separate directory. ```sh svn co https://plugins.svn.wordpress.org/secure-custom-fields secure-custom-fields-svn ``` -------------------------------- ### acf_get_metadata_by_field() Source: https://github.com/wordpress/secure-custom-fields/blob/trunk/docs/code-reference/acf-meta-functions-file.md Gets metadata from the database using post ID, field array, and an optional hidden flag. ```APIDOC ## `acf_get_metadata_by_field()` ### Description Gets metadata from the database. ### Parameters #### Path Parameters - **$post_id** (integer|string) - The post id. - **$field** (array) - The field array. - **$hidden** (boolean) - Optional. True if we should return the reference key. ### Returns - **mixed** - The metadata value. ``` -------------------------------- ### acf_init() Source: https://github.com/wordpress/secure-custom-fields/blob/trunk/docs/code-reference/api/api-helpers-file.md Initializes the ACF core functions. This is an alias for `acf()->init()` and should be called to ensure ACF is properly set up. ```APIDOC ## `acf_init()` ### Description Alias of `acf()->init()` - the core ACF init function. ### Returns - n/a ``` -------------------------------- ### acf_get_form_data() Source: https://github.com/wordpress/secure-custom-fields/blob/trunk/docs/code-reference/acf-form-functions-file.md Gets data about the current form. This function retrieves the currently stored data for an ACF form. ```APIDOC ## `acf_get_form_data()` ### Description Gets data about the current form. ### Parameters * **$name** (string) - The store name. ### Return * **mixed** - Returns the form data. ``` -------------------------------- ### Run All PHP Tests Source: https://github.com/wordpress/secure-custom-fields/blob/trunk/AGENTS.md Executes all PHP tests, including PHPUnit and PHPStan. Requires wp-env to be running. ```bash composer test # All PHP tests (PHPUnit + PHPStan) ``` -------------------------------- ### acf_get_post_type_post() Source: https://github.com/wordpress/secure-custom-fields/blob/trunk/docs/code-reference/acf-post-type-functions-file.md Gets the post object associated with an ACF Post Type. Requires ACF version 6.1 or later. ```APIDOC ## acf_get_post_type_post() ### Description Gets a post object for an ACF CPT. ### Parameters #### Path Parameters - **id** (integer|string) - Required - The post ID, key, or name. ### Returns - **object|boolean** - The post object, or false on failure. ``` -------------------------------- ### acf_get_current_url() Source: https://github.com/wordpress/secure-custom-fields/blob/trunk/docs/code-reference/acf-helper-functions-file.md Retrieves the current URL of the page being accessed. This is a convenient way to get the full URL without manual construction. ```APIDOC ## `acf_get_current_url()` Returns the current URL. * @date 23/01/2015 * @since ACF 5.1.5 * @return string ``` -------------------------------- ### Run Specific PHPUnit Test File Source: https://github.com/wordpress/secure-custom-fields/blob/trunk/AGENTS.md Executes PHPUnit tests for a specific file. Requires wp-env to be running. ```bash vendor/bin/phpunit # Specific file ``` -------------------------------- ### acf_get_raw_ui_options_pages() Source: https://github.com/wordpress/secure-custom-fields/blob/trunk/docs/code-reference/scf-ui-options-page-functions-file.md Retrieves an array of all raw SCF UI options pages. ```APIDOC ## acf_get_raw_ui_options_pages() ### Description Returns an array of raw SCF UI options pages. ### Returns - array - An array of raw SCF UI options pages. ``` -------------------------------- ### acf_get_external_dir() Source: https://github.com/wordpress/secure-custom-fields/blob/trunk/docs/code-reference/api/api-helpers-file.md Retrieves the URL to a file located within an internal ACF folder. This function is used to get accessible web paths for ACF assets. ```APIDOC ## `acf_get_external_dir()` ### Description Retrieves the URL to a file located within an internal ACF folder. ### Parameters #### Path Parameters - **file** (string) - Required - The directory path. - **path** (string) - Optional - An optional file path. ### Returns - string - The full file path. ``` -------------------------------- ### acf_render_field_instructions() Source: https://github.com/wordpress/secure-custom-fields/blob/trunk/docs/code-reference/acf-field-functions-file.md Renders the instructions associated with an ACF field. This can be used to display help text or tooltips. ```APIDOC ## `acf_render_field_instructions()` ### Description Renders the field's instructions. ### Parameters #### Path Parameters - **field** (array) - Required - The field array. - **tooltip** (boolean) - Optional - If the instructions are being rendered as a tooltip. ### Returns void ``` -------------------------------- ### Copy Release Contents to SVN Trunk Source: https://github.com/wordpress/secure-custom-fields/blob/trunk/docs/contributing/releases.md After creating the distribution zip, unzip it and copy its contents to the 'trunk' folder within your local SVN repository checkout. ```sh unzip release/secure-custom-fields.zip cp -R * ../secure-custom-fields-svn/trunk/ ``` -------------------------------- ### Run JavaScript Unit Tests Source: https://github.com/wordpress/secure-custom-fields/blob/trunk/AGENTS.md Executes Jest unit tests for JavaScript code. Requires wp-env to be running. ```bash npm run test:unit # Jest unit tests ``` -------------------------------- ### Add New Files in SVN Source: https://github.com/wordpress/secure-custom-fields/blob/trunk/docs/contributing/releases.md Use 'svn status' to identify any new files not under version control (marked with '?'). Add these files to SVN using 'svn add'. ```sh cd ../secure-custom-fields-svn svn status svn add ``` -------------------------------- ### Run Specific End-to-End Test File Source: https://github.com/wordpress/secure-custom-fields/blob/trunk/AGENTS.md Executes a specific Playwright end-to-end test file. Requires wp-env to be running. ```bash npm run test:e2e -- # Specific test file ``` -------------------------------- ### acf_import_ui_options_page() Source: https://github.com/wordpress/secure-custom-fields/blob/trunk/docs/code-reference/scf-ui-options-page-functions-file.md Imports an SCF UI options page into the database. ```APIDOC ## acf_import_ui_options_page() ### Description Imports an ACF UI options page into the database. ### Parameters #### Path Parameters - **ui_options_page** (array) - Required - The ACF UI options page array. ### Returns - array - The imported options page. ``` -------------------------------- ### acf_prepare_block() Source: https://github.com/wordpress/secure-custom-fields/blob/trunk/docs/code-reference/blocks-file.md Prepares a block for rendering by merging its settings and attributes. ```APIDOC ## `acf_prepare_block()` Prepares a block for use in render_callback by merging in all settings and attributes. ### Description This function is used to prepare a block before it is rendered. It merges the block's settings with its attributes, ensuring all necessary data is available for the `render_callback` function. ### Parameters * **$block** (array) - Required - The block props. ### Return Value * (array|boolean) - Returns the prepared block array on success, or false on failure. ``` -------------------------------- ### acf_get_store() Source: https://github.com/wordpress/secure-custom-fields/blob/trunk/docs/code-reference/acf-utility-functions-file.md Returns a data store. ```APIDOC ## acf_get_store() ### Description Returns a data store. ### Parameters #### Path Parameters - **name** (string) - Required - The store name. ### Returns - ACF_Data - The requested data store. ``` -------------------------------- ### acf_render_field_wrap_description() Source: https://github.com/wordpress/secure-custom-fields/blob/trunk/docs/code-reference/deprecated-file.md Renders the field's instructions. This function is deprecated and should not be used. ```APIDOC ## Deprecated Function: acf_render_field_wrap_description() ### Description Renders the field's instructions. ### Parameters - **$field** (array) - Required - The field array. ### Return Value void ### Deprecated Deprecated in ACF 5.6.5. Use alternative methods if available. ``` -------------------------------- ### Run PHPStan Static Analysis Source: https://github.com/wordpress/secure-custom-fields/blob/trunk/AGENTS.md Performs static analysis on the PHP code. Requires wp-env to be running. ```bash composer test:phpstan # Static analysis only ``` -------------------------------- ### acf_upgrade_all() Source: https://github.com/wordpress/secure-custom-fields/blob/trunk/docs/code-reference/upgrades-file.md Initiates all available database upgrade routines for ACF if an upgrade is pending. ```APIDOC ## `acf_upgrade_all()` ### Description Runs upgrade routines if this site has an upgrade available. ### Returns void ``` -------------------------------- ### Run End-to-End Tests with Visible Browser Source: https://github.com/wordpress/secure-custom-fields/blob/trunk/AGENTS.md Executes Playwright end-to-end tests with the browser window visible. Requires wp-env to be running. ```bash npm run test:e2e -- --headed # Run with browser visible ``` -------------------------------- ### Run PHPUnit Tests Only Source: https://github.com/wordpress/secure-custom-fields/blob/trunk/AGENTS.md Executes only PHPUnit tests. Requires wp-env to be running. ```bash composer test:php # PHPUnit tests only ``` -------------------------------- ### acf_trash_ui_options_page() Source: https://github.com/wordpress/secure-custom-fields/blob/trunk/docs/code-reference/scf-ui-options-page-functions-file.md Moves an SCF UI options page to the trash. ```APIDOC ## acf_trash_ui_options_page() ### Description Trashes an ACF UI options page. ### Parameters #### Path Parameters - **id** (integer|string) - Required - The UI options page ID, key, or name. ### Returns - boolean - True if the options page was trashed. ``` -------------------------------- ### Run JavaScript Unit Tests in Watch Mode Source: https://github.com/wordpress/secure-custom-fields/blob/trunk/AGENTS.md Executes Jest unit tests and watches for file changes. Requires wp-env to be running. ```bash npm run test:unit:watch # Jest in watch mode ``` -------------------------------- ### Include Composer Autoloader Source: https://github.com/wordpress/secure-custom-fields/blob/trunk/docs/welcome/installation.md Add this line to your plugin or theme's main file to ensure that all Composer-managed dependencies, including Secure Custom Fields, are loaded automatically. ```php require_once plugin_dir_path(dirname(__FILE__)) . 'vendor/autoload.php'; ``` -------------------------------- ### acf_new_instance() Source: https://github.com/wordpress/secure-custom-fields/blob/trunk/docs/code-reference/acf-utility-functions-file.md Creates a new instance of the given class and stores it in the instances data store. ```APIDOC ## acf_new_instance() ### Description Creates a new instance of the given class and stores it in the instances data store. ### Parameters #### Path Parameters - **class** (string) - Required - The class name. ### Returns - object - The instance. ``` -------------------------------- ### acf_prepare_taxonomy_for_import() Source: https://github.com/wordpress/secure-custom-fields/blob/trunk/docs/code-reference/acf-taxonomy-functions-file.md Prepares an ACF taxonomy array for the import process. ```APIDOC ## acf_prepare_taxonomy_for_import() ### Description Prepares an ACF taxonomy for the import process. ### Parameters #### Path Parameters - **taxonomy** (array) - Required - The ACF taxonomy array. ### Returns - **array** - The ACF taxonomy array prepared for import. ``` -------------------------------- ### acf_new_admin_notice() Source: https://github.com/wordpress/secure-custom-fields/blob/trunk/docs/code-reference/admin/admin-notices-file.md Instantiates and returns a new admin notice model. ```APIDOC ## `acf_new_admin_notice()` ### Description Instantiates and returns a new model for an admin notice. ### Parameters #### Arguments - `$data` (array) - Optional data to set for the notice. ### Returns - `ACF_Admin_Notice` - An instance of the ACF_Admin_Notice model. ``` -------------------------------- ### acf_get_view() Source: https://github.com/wordpress/secure-custom-fields/blob/trunk/docs/code-reference/api/api-helpers-file.md Loads a file from the 'admin/views' folder and allows variables to be passed through for rendering. ```APIDOC ## `acf_get_view()` ### Description This function will load in a file from the 'admin/views' folder and allow variables to be passed through. ### Parameters #### Arguments - **$view_path** (string) - The path to the view file. - **$view_args** (array) - An array of variables to pass to the view. ### Returns - **string** - The rendered view content. ``` -------------------------------- ### acf_get_full_version() Source: https://github.com/wordpress/secure-custom-fields/blob/trunk/docs/code-reference/api/api-helpers-file.md Removes beta or release candidate suffixes from a version string. ```APIDOC ## `acf_get_full_version()` ### Description This function will remove any '-beta1' or '-RC1' strings from a version. ### Parameters #### Path Parameters - **version** (string) - Required - The version string to process. ### Return - (string) The cleaned version string. ``` -------------------------------- ### acf_untrash_ui_options_page() Source: https://github.com/wordpress/secure-custom-fields/blob/trunk/docs/code-reference/scf-ui-options-page-functions-file.md Restores an SCF UI options page from the trash. ```APIDOC ## acf_untrash_ui_options_page() ### Description Restores an ACF UI options page from the trash. ### Parameters #### Path Parameters - **id** (integer|string) - Required - The UI options page ID, key, or name. ### Returns - boolean - True if the options page was untrashed. ``` -------------------------------- ### acf_get_block_back_compat_attribute_key_array() Source: https://github.com/wordpress/secure-custom-fields/blob/trunk/docs/code-reference/blocks-file.md Retrieves an array of back-compatibility attribute keys, mapping new values to old values. ```APIDOC ## `acf_get_block_back_compat_attribute_key_array()` Get back compat new values and old values. * @since ACF 6.0.0 * @return array back compat key array. ``` -------------------------------- ### acf_translate_ui_options_page() Source: https://github.com/wordpress/secure-custom-fields/blob/trunk/docs/code-reference/scf-ui-options-page-functions-file.md Translates the settings of an SCF UI options page. ```APIDOC ## acf_translate_ui_options_page() ### Description Translates the settings for an SCF UI options page. ### Parameters #### Path Parameters - **ui_options_page** (array) - Required - The SCF UI options page array. ### Returns - array - The translated UI options page array. ``` -------------------------------- ### acf_get_raw_ui_options_page() Source: https://github.com/wordpress/secure-custom-fields/blob/trunk/docs/code-reference/scf-ui-options-page-functions-file.md Retrieves the raw data for a specific SCF UI options page. ```APIDOC ## acf_get_raw_ui_options_page() ### Description Retrieves a raw SCF UI options page. ### Parameters #### Path Parameters - **id** (integer|string) - Required - The post ID. ### Returns - array|false - The UI options page array, or false if not found. ``` -------------------------------- ### acf_version_compare() Source: https://github.com/wordpress/secure-custom-fields/blob/trunk/docs/code-reference/api/api-helpers-file.md Compares two version numbers, similar to WordPress's version_compare() but with additional functionality. ```APIDOC ## `acf_version_compare()` ### Description Similar to the version_compare() function but with extra functionality. ### Parameters #### Path Parameters - **left** (string) - Required - The left version number. - **compare** (string) - Required - The compare operator (e.g., '==', '!=', '>', '<', '>=', '<='). - **right** (string) - Required - The right version number. ### Return - boolean - True if the comparison is true, false otherwise. ``` -------------------------------- ### acf_is_ui_options_page() Source: https://github.com/wordpress/secure-custom-fields/blob/trunk/docs/code-reference/scf-ui-options-page-functions-file.md Checks if the provided parameters match an existing SCF UI options page. ```APIDOC ## acf_is_ui_options_page() ### Description Returns true if the given params match an ACF UI options page. ### Parameters #### Path Parameters - **ui_options_page** (array) - Required - The ACF UI options page array. ### Returns - boolean - True if the parameters match an ACF UI options page. ``` -------------------------------- ### acf_prepare_post_type_for_import() Source: https://github.com/wordpress/secure-custom-fields/blob/trunk/docs/code-reference/acf-post-type-functions-file.md Prepares an ACF Post Type array for the import process. Requires ACF version 6.1 or later. ```APIDOC ## acf_prepare_post_type_for_import() ### Description Prepares an ACF post type for the import process. ### Parameters #### Request Body - **post_type** (array) - Required - The ACF post type array. ### Returns - **array** ``` -------------------------------- ### acf_get_local_store() Source: https://github.com/wordpress/secure-custom-fields/blob/trunk/docs/code-reference/local-fields-file.md Retrieves the local store or a dummy store for a given name or post type. ```APIDOC ## Function: acf_get_local_store() ### Description Returns either local store or a dummy store for the given name or post type. ### Parameters #### Path Parameters - **name** (string) - Required - The store name. - **post_type** (string) - Required - The post type for the desired store. ### Returns ACF_Data ``` -------------------------------- ### acf_get_ui_options_pages() Source: https://github.com/wordpress/secure-custom-fields/blob/trunk/docs/code-reference/scf-ui-options-page-functions-file.md Retrieves an array of SCF UI options pages, with optional filtering. ```APIDOC ## acf_get_ui_options_pages() ### Description Returns an array of SCF UI options pages for the given $filter. ### Parameters #### Path Parameters - **filter** (array) - Optional - An array of args to filter results by. ### Returns - array - An array of SCF UI options pages. ``` -------------------------------- ### acf_get_compatibility() Source: https://github.com/wordpress/secure-custom-fields/blob/trunk/docs/code-reference/compatibility-file.md Returns true if compatibility is enabled for the given component. ```APIDOC ## `acf_get_compatibility()` ### Description Returns true if compatibility is enabled for the given component. ### Parameters #### Path Parameters - **name** (string) - Required - The name of the component to check. ### Response #### Success Response (boolean) - **return** (boolean) - True if compatibility is enabled, false otherwise. ``` -------------------------------- ### Create New Tag Locally in SVN Source: https://github.com/wordpress/secure-custom-fields/blob/trunk/docs/contributing/releases.md Copy the 'trunk' directory to a new 'tags/x.y.z' directory within your SVN repository to create a local tag for the new version. ```sh svn cp trunk tags/x.y.z ``` -------------------------------- ### Run Specific PHPUnit Test Source: https://github.com/wordpress/secure-custom-fields/blob/trunk/AGENTS.md Filters and runs a specific PHPUnit test by name. Requires wp-env to be running. ```bash composer test:php -- --filter= # Specific test ``` -------------------------------- ### acf_export_ui_options_page_as_php() Source: https://github.com/wordpress/secure-custom-fields/blob/trunk/docs/code-reference/scf-ui-options-page-functions-file.md Exports an SCF UI options page into PHP code format. ```APIDOC ## acf_export_ui_options_page_as_php() ### Description Exports an ACF UI options page as PHP. ### Parameters #### Path Parameters - **ui_options_page** (array) - Required - The ACF UI options page array. ### Returns - string|boolean - The PHP code representation of the UI options page, or false on failure. ``` -------------------------------- ### acf_upgrade_550() Source: https://github.com/wordpress/secure-custom-fields/blob/trunk/docs/code-reference/upgrades-file.md Performs the upgrade routine for version 5.5.0, which adds support for the `wp_termmeta` table. ```APIDOC ## `acf_upgrade_550()` ### Description Version 5.5 adds support for the wp_termmeta table added in WP 4.4. ### Returns void ``` -------------------------------- ### acf_get_option_meta() Source: https://github.com/wordpress/secure-custom-fields/blob/trunk/docs/code-reference/acf-meta-functions-file.md Returns an array of meta for a given wp_option name prefix. ```APIDOC ## `acf_get_option_meta()` ### Description Returns an array of meta for the given wp_option name prefix in the same format as get_post_meta(). ### Parameters #### Path Parameters - **$prefix** (string) - The wp_option name prefix. ### Returns - **array** - An array of meta data. ``` -------------------------------- ### acf_get_path() Source: https://github.com/wordpress/secure-custom-fields/blob/trunk/docs/code-reference/acf-utility-functions-file.md Returns the plugin path to a specified file. ```APIDOC ## acf_get_path() ### Description Returns the plugin path to a specified file. ### Parameters #### Path Parameters - **filename** (string) - Required - The specified file. ### Returns - string - The plugin path to the specified file. ``` -------------------------------- ### acf_nonce_input() Source: https://github.com/wordpress/secure-custom-fields/blob/trunk/docs/code-reference/api/api-helpers-file.md Creates and echoes a basic nonce input field for security purposes. ```APIDOC ## `acf_nonce_input()` ### Description This function will create and echo a basic nonce input. ### Parameters #### Arguments - **$nonce** (string) - The nonce parameter string. ### Returns - **void** - This function echoes the nonce input directly. ``` -------------------------------- ### acf_get_instance() Source: https://github.com/wordpress/secure-custom-fields/blob/trunk/docs/code-reference/acf-utility-functions-file.md Returns an instance for the given class. ```APIDOC ## acf_get_instance() ### Description Returns an instance for the given class. ### Parameters #### Path Parameters - **class** (string) - Required - The class name. ### Returns - object - The instance. ``` -------------------------------- ### acf_register_store() Source: https://github.com/wordpress/secure-custom-fields/blob/trunk/docs/code-reference/acf-utility-functions-file.md Registers a data store. ```APIDOC ## acf_register_store() ### Description Registers a data store. ### Parameters #### Path Parameters - **name** (string) - Required - The store name. - **data** (array) - Required - Array of data to start the store with. ### Returns - ACF_Data - The registered data store. ``` -------------------------------- ### acf_doing() Source: https://github.com/wordpress/secure-custom-fields/blob/trunk/docs/code-reference/api/api-helpers-file.md Indicates what task ACF is currently performing. ```APIDOC ## `acf_doing()` acf_doing * This function will tell ACF what task it is doing * @since ACF 5.3.8 * @param $event (string) * @param context (string) * @return n/a ``` -------------------------------- ### acf_load_textdomain() Source: https://github.com/wordpress/secure-custom-fields/blob/trunk/docs/code-reference/l10n-file.md Loads the translated strings for the plugin, similar to the WordPress `load_plugin_textdomain()` function. ```APIDOC ## `acf_load_textdomain()` ### Description Loads the plugin's translated strings similar to `load_plugin_textdomain()`. ### Parameters #### Path Parameters * **$locale** (string) - Required - The plugin's current locale. ### Returns * void ``` -------------------------------- ### acf_file_input() Source: https://github.com/wordpress/secure-custom-fields/blob/trunk/docs/code-reference/acf-input-functions-file.md Renders the HTML for a file input field. ```APIDOC ## `acf_file_input()` ### Description Renders the HTML of a file input. ### Parameters #### Path Parameters * None #### Query Parameters * None #### Request Body * None ### Method * Not applicable (PHP function) ### Endpoint * Not applicable (PHP function) ### Response #### Success Response * Echos the HTML of the file input. ### Request Example * Not applicable (PHP function) ### Response Example * Not applicable (PHP function) ``` -------------------------------- ### acf_add_admin_notice() Source: https://github.com/wordpress/secure-custom-fields/blob/trunk/docs/code-reference/admin/admin-notices-file.md Creates and returns a new admin notice. ```APIDOC ## `acf_add_admin_notice()` ### Description Creates and returns a new notice. ### Parameters #### Arguments - `$text` (string) - The admin notice text content. - `$type` (string) - The type of notice (e.g., 'warning', 'error', 'success', 'info'). - `$dismissible` (boolean) - Optional. Whether the notice is dismissible. Defaults to true (since ACF 5.11.0). - `$persisted` (boolean) - Optional. Whether to store the notice dismissal per user to prevent it from showing again. Defaults to false (since ACF 6.1.0). ### Returns - `ACF_Admin_Notice` - An instance of the ACF_Admin_Notice model. ``` -------------------------------- ### Run All End-to-End Tests Source: https://github.com/wordpress/secure-custom-fields/blob/trunk/AGENTS.md Executes all Playwright end-to-end tests. IMPORTANT: Always use npm scripts, never 'npx playwright test' directly. Requires wp-env to be running. ```bash npm run test:e2e # All E2E tests ``` -------------------------------- ### acf_textarea_input() Source: https://github.com/wordpress/secure-custom-fields/blob/trunk/docs/code-reference/acf-input-functions-file.md Renders the HTML for a textarea input field. ```APIDOC ## `acf_textarea_input()` ### Description Renders the HTML of a textarea input. ### Parameters #### Path Parameters * None #### Query Parameters * None #### Request Body * None ### Method * Not applicable (PHP function) ### Endpoint * Not applicable (PHP function) ### Response #### Success Response * Echos the HTML of the textarea input. ### Request Example * Not applicable (PHP function) ### Response Example * Not applicable (PHP function) ``` -------------------------------- ### acf_get_version_when_first_activated() Source: https://github.com/wordpress/secure-custom-fields/blob/trunk/docs/code-reference/acf-helper-functions-file.md Retrieves the version of ACF that was active when the plugin was first activated. Returns false if this information is unavailable. ```APIDOC ## `acf_get_version_when_first_activated()` Returns the version of ACF when it was first activated. However, if ACF was first activated prior to the introduction of the acf_first_activated_version option, this function returns false (boolean) to indicate that the version could not be determined. * @since ACF 6.3 * @return string|boolean The (string) version of ACF when it was first activated, or false (boolean) if the version could not be determined. ``` -------------------------------- ### acf_prepare_taxonomy_for_export() Source: https://github.com/wordpress/secure-custom-fields/blob/trunk/docs/code-reference/acf-taxonomy-functions-file.md Prepares an ACF taxonomy array for export. ```APIDOC ## acf_prepare_taxonomy_for_export() ### Description Returns a modified ACF taxonomy ready for export. ### Parameters #### Path Parameters - **taxonomy** (array) - Required - The ACF taxonomy array. ### Returns - **array** - The ACF taxonomy array prepared for export. ``` -------------------------------- ### acf_get_user_setting() Source: https://github.com/wordpress/secure-custom-fields/blob/trunk/docs/code-reference/api/api-helpers-file.md Retrieves a user setting. ```APIDOC ## `acf_get_user_setting()` ### Description Retrieves a user setting. ### Parameters #### Path Parameters - **$post_id** (int) - The ID of the post associated with the setting. ### Returns $post_id (int) - The retrieved post ID. ``` -------------------------------- ### acf_get_bidirectional_field_settings_instruction_text() Source: https://github.com/wordpress/secure-custom-fields/blob/trunk/docs/code-reference/acf-bidirectional-functions-file.md Returns the translated instructional text for the message field within the bidirectional field settings. This text provides guidance to the user. ```APIDOC ## `acf_get_bidirectional_field_settings_instruction_text()` ### Description Returns the translated instructional text for the message field for the bidirectional field settings. ### Returns - string - The html containing the instructional message. ``` -------------------------------- ### acf_get_image_sizes() Source: https://github.com/wordpress/secure-custom-fields/blob/trunk/docs/code-reference/api/api-helpers-file.md Retrieves an array of all available image sizes registered in WordPress. ```APIDOC ## `acf_get_image_sizes()` ### Description This function will return an array of available image sizes. ### Parameters #### Path Parameters - **n/a** ### Return - array - An array containing the available image sizes. ``` -------------------------------- ### acf_raw_setting() Source: https://github.com/wordpress/secure-custom-fields/blob/trunk/docs/code-reference/api/api-helpers-file.md Retrieves a raw setting value. This is an alias for `acf()->get_setting()`. ```APIDOC ## `acf_raw_setting()` ### Description acf_raw_setting * alias of acf()->get_setting() ### Returns - n/a ``` -------------------------------- ### acf_select_input() Source: https://github.com/wordpress/secure-custom-fields/blob/trunk/docs/code-reference/acf-input-functions-file.md Renders the HTML for a select input field. ```APIDOC ## `acf_select_input()` ### Description Renders the HTML of a select input. ### Parameters #### Path Parameters * None #### Query Parameters * None #### Request Body * None ### Method * Not applicable (PHP function) ### Endpoint * Not applicable (PHP function) ### Response #### Success Response * Echos the HTML of the select input. ### Request Example * Not applicable (PHP function) ### Response Example * Not applicable (PHP function) ``` -------------------------------- ### acf_upload_files() Source: https://github.com/wordpress/secure-custom-fields/blob/trunk/docs/code-reference/api/api-helpers-file.md Walks through $_FILES data and uploads each found file. ```APIDOC ## `acf_upload_files()` This function will walk through the $_FILES data and upload each found. * @since ACF 5.0.9 * @param array $ancestors An internal parameter, not required. ``` -------------------------------- ### acf_walk_select_input() Source: https://github.com/wordpress/secure-custom-fields/blob/trunk/docs/code-reference/acf-input-functions-file.md Returns the HTML for the choices within a select input, used for recursive rendering. ```APIDOC ## `acf_walk_select_input()` ### Description Returns the HTML of a select input's choices. ### Parameters #### Path Parameters * None #### Query Parameters * None #### Request Body * None ### Method * Not applicable (PHP function) ### Endpoint * Not applicable (PHP function) ### Response #### Success Response * Returns the HTML string of the select input's choices. ### Request Example * Not applicable (PHP function) ### Response Example * Not applicable (PHP function) ``` -------------------------------- ### Check JavaScript Linting Source: https://github.com/wordpress/secure-custom-fields/blob/trunk/AGENTS.md Checks JavaScript code for linting errors using wp-scripts. ```bash npx wp-scripts lint-js # Check JavaScript linting ``` -------------------------------- ### acf_format_filesize() Source: https://github.com/wordpress/secure-custom-fields/blob/trunk/docs/code-reference/api/api-helpers-file.md Formats a given file size into a human-readable string with appropriate units. ```APIDOC ## `acf_format_filesize()` ### Description This function will return a formatted string containing the filesize and unit. ### Parameters * **$size** (mixed) - Description not specified. ### Returns * (int) - The formatted filesize string. ``` -------------------------------- ### scf_get_admin_beta_features_url() Source: https://github.com/wordpress/secure-custom-fields/blob/trunk/docs/code-reference/admin/beta-features-file.md Retrieves the administrative URL for the beta features page within the WordPress dashboard. ```APIDOC ## `scf_get_admin_beta_features_url()` ### Description Returns the admin URL to the beta features page. ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Returns * **string** - The URL to the beta features page. ### Example ```php $beta_features_url = scf_get_admin_beta_features_url(); echo 'Beta Features'; ``` ``` -------------------------------- ### acf_process_block_toolbar_fields() Source: https://github.com/wordpress/secure-custom-fields/blob/trunk/docs/code-reference/blocks-file.md Prepares an array of fields for localization and use in the frontend block toolbar. This function ensures that field data is correctly formatted for JavaScript consumption, enabling dynamic toolbar field display. ```APIDOC ## `acf_process_block_toolbar_fields()` ### Description This function prepares a fields array for being localized and used on the frontend as block toolbar fields. ### Parameters * **`$fields`** (array) - Required - A list of fields, each to be displayed in the popup toolbar. Fields can be specified as a string (field name) or an associative array with specific keys: * **`$field_name`** (string) - The name of the field to display in the toolbar. * **`$field_icon`** (string) - An HTML tag (e.g., SVG) for the toolbar icon. Defaults to the first field's icon. * **`$field_label`** (string) - A string to use as the label for the button in the toolbar. ### Returns * **array** - The array of fields, prepared for JS localization. ``` -------------------------------- ### acf_verify_ajax() Source: https://github.com/wordpress/secure-custom-fields/blob/trunk/docs/code-reference/api/api-helpers-file.md Validates the current AJAX request, ensuring it is legitimate and handling WPML language settings. ```APIDOC ## `acf_verify_ajax()` ### Description 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. ### Parameters #### Path Parameters - **nonce** (string) - Required - The nonce to check. - **action** (string) - Required - The action of the nonce. - **action_is_field** (boolean) - Optional - Whether the action is a field key or not. Defaults to false. - **expected_field_type** (string) - Optional - Prevents a nonce minted for one field type from being accepted by an AJAX handler that expects a different one. Defaults to empty (no type validation). ### Return - boolean - True if the AJAX request is valid, false otherwise. ``` -------------------------------- ### the_row() Source: https://github.com/wordpress/secure-custom-fields/blob/trunk/docs/code-reference/api/api-template-file.md Progresses the global repeater or flexible content value by one row. ```APIDOC ## the_row() ### Description This function will progress the global repeater or flexible content value 1 row. * @since ACF 4.3.0 * @param N/A * @return (array) the current row data ``` -------------------------------- ### acf_prepare_field() Source: https://github.com/wordpress/secure-custom-fields/blob/trunk/docs/code-reference/acf-field-functions-file.md Prepares a field array for input, ensuring it's ready for rendering or processing. ```APIDOC ## `acf_prepare_field()` ### Description Prepare a field for input. ### Parameters #### Path Parameters - **field** (array) - Required - The field array. ### Returns - array - The prepared field array. ``` -------------------------------- ### acf_text_input() Source: https://github.com/wordpress/secure-custom-fields/blob/trunk/docs/code-reference/acf-input-functions-file.md Renders the HTML for a text input field. ```APIDOC ## `acf_text_input()` ### Description Renders the HTML of a text input. ### Parameters #### Path Parameters * None #### Query Parameters * None #### Request Body * None ### Method * Not applicable (PHP function) ### Endpoint * Not applicable (PHP function) ### Response #### Success Response * Echos the HTML of the text input. ### Request Example * Not applicable (PHP function) ### Response Example * Not applicable (PHP function) ``` -------------------------------- ### Check PHP Coding Standards Source: https://github.com/wordpress/secure-custom-fields/blob/trunk/AGENTS.md Checks PHP code against WordPress coding standards using phpcs. ```bash composer lint:php # Check PHP standards (phpcs) ``` -------------------------------- ### Format JavaScript Code Source: https://github.com/wordpress/secure-custom-fields/blob/trunk/AGENTS.md Automatically fixes JavaScript formatting issues using wp-scripts. ```bash npx wp-scripts format # Fix JavaScript formatting ``` -------------------------------- ### acf_get_ui_options_page() Source: https://github.com/wordpress/secure-custom-fields/blob/trunk/docs/code-reference/scf-ui-options-page-functions-file.md Retrieves a specific SCF UI options page by its ID. ```APIDOC ## acf_get_ui_options_page() ### Description Get an SCF UI options page as an array. ### Parameters #### Path Parameters - **id** (integer|string) - Required - The post ID being queried. ### Returns - array|false - The UI options page array, or false if not found. ``` -------------------------------- ### acf_get_sites() Source: https://github.com/wordpress/secure-custom-fields/blob/trunk/docs/code-reference/api/api-helpers-file.md Retrieves an array of all sites within a WordPress network. ```APIDOC ## `acf_get_sites()` ### Description Returns an array of sites for a network. ### Returns - **array** - An array containing site information. ``` -------------------------------- ### acf_handle_json_block_registration() Source: https://github.com/wordpress/secure-custom-fields/blob/trunk/docs/code-reference/blocks-file.md Handles the registration of an SCF block that is defined using block.json. It processes the block settings and metadata to ensure proper registration. ```APIDOC ## `acf_handle_json_block_registration()` ### Description Handle an SCF block registered through block.json. ### Parameters #### Path Parameters - **settings** (array) - Required - The compiled block settings. - **metadata** (array) - Required - The raw json metadata. ### Return Value - **array** - Block registration settings with ACF required additions. ``` -------------------------------- ### acf_slugify() Source: https://github.com/wordpress/secure-custom-fields/blob/trunk/docs/code-reference/acf-helper-functions-file.md Generates a URL-friendly slug from a given string. It can also accept a glue character to join slug pieces. ```APIDOC ## `acf_slugify()` ### Description Returns a slug friendly string. ### Parameters #### Path Parameters - **$str** (string) - The string to convert. - **$glue** (string) - The glue between each slug piece. ### Returns - string ``` -------------------------------- ### Run End-to-End Tests in Debug Mode Source: https://github.com/wordpress/secure-custom-fields/blob/trunk/AGENTS.md Executes Playwright end-to-end tests in debug mode. Requires wp-env to be running. ```bash npm run test:e2e:debug # Debug mode ``` -------------------------------- ### acf_prepare_post_type_for_export() Source: https://github.com/wordpress/secure-custom-fields/blob/trunk/docs/code-reference/acf-post-type-functions-file.md Prepares an ACF Post Type array for export. Requires ACF version 6.1 or later. ```APIDOC ## acf_prepare_post_type_for_export() ### Description Returns a modified ACF post type ready for export. ### Parameters #### Request Body - **post_type** (array) - Required - The ACF post type array. ### Returns - **array** ``` -------------------------------- ### ACF API Helper Functions Source: https://github.com/wordpress/secure-custom-fields/blob/trunk/docs/code-reference/META.md Provides utility functions for interacting with ACF settings, data, and post information. ```APIDOC ## Functions - `_acf_settings_uploader` - `acf_decode_choices` - `acf_get_image_size` - `acf_get_post_title` - `acf_get_pretty_post_types` - `acf_maybe_get_GET` - `acf_maybe_get_POST` - `acf_order_by_search` ``` -------------------------------- ### acf_render_admin_notices() Source: https://github.com/wordpress/secure-custom-fields/blob/trunk/docs/code-reference/admin/admin-notices-file.md Renders all registered admin notices as HTML. ```APIDOC ## `acf_render_admin_notices()` ### Description Renders all admin notices HTML. ### Returns - `void` - This function does not return a value, it directly outputs HTML. ``` -------------------------------- ### Check Specific PHP File for Standards Source: https://github.com/wordpress/secure-custom-fields/blob/trunk/AGENTS.md Checks a specific PHP file for coding standards violations. ```bash vendor/bin/phpcs # Check specific file ``` -------------------------------- ### acf_upgrade_550_termmeta() Source: https://github.com/wordpress/secure-custom-fields/blob/trunk/docs/code-reference/upgrades-file.md Migrates all ACF 4.x term meta data from `wp_options` to the `wp_termmeta` table. ```APIDOC ## `acf_upgrade_550_termmeta()` ### Description Upgrades all ACF4 termmeta saved in wp_options to the wp_termmeta table. ### Returns void ``` -------------------------------- ### acf_get_browser() Source: https://github.com/wordpress/secure-custom-fields/blob/trunk/docs/code-reference/api/api-helpers-file.md Returns the name of the current browser. ```APIDOC ## `acf_get_browser()` acf_get_browser * Returns the name of the current browser. * @since ACF 5.0.0 * @return string ``` -------------------------------- ### acf_get_meta_instance() Source: https://github.com/wordpress/secure-custom-fields/blob/trunk/docs/code-reference/acf-meta-functions-file.md Retrieves an ACF meta instance for the provided meta type. ```APIDOC ## `acf_get_meta_instance()` ### Description Retrieves an ACF meta instance for the provided meta type. ### Parameters #### Path Parameters - **$type** (string) - The meta type as decoded from the post ID. ### Returns - **object|null** - The ACF meta instance or null if not found. ``` -------------------------------- ### acf_plugin_dir_url() Source: https://github.com/wordpress/secure-custom-fields/blob/trunk/docs/code-reference/api/api-helpers-file.md Calculates the URL to a plugin folder, even for plugins included within a theme. This differs from the standard `plugin_dir_url()`. ```APIDOC ## `acf_plugin_dir_url()` ### Description Calculates 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). ### Parameters #### Path Parameters - **file** (string) - Required - A file path inside the ACF plugin to get the plugin directory path from. ### Returns - string - The plugin directory URL. ``` -------------------------------- ### acf_prepare_fields_for_import() Source: https://github.com/wordpress/secure-custom-fields/blob/trunk/docs/code-reference/acf-field-functions-file.md Prepares an array of ACF fields for import. This function ensures that field data is correctly formatted before being imported. ```APIDOC ## `acf_prepare_fields_for_import()` ### Description Returns a modified array of fields ready for import. ### Parameters * **$fields** (array) - An array of fields. ### Returns * (array) ```