### Install Composer Dependencies (Shorthand) Source: https://developer.wordpress.org/secure-custom-fields/installation Use this shorthand command as an alternative to 'composer install' to install all defined dependencies. ```bash composer i ``` -------------------------------- ### Install Dependencies with Composer Source: https://developer.wordpress.org/secure-custom-fields/contributing Use this command to install project dependencies managed by Composer. Ensure Composer is installed and accessible in your PATH. ```bash composer install ``` -------------------------------- ### Install Composer Dependencies Source: https://developer.wordpress.org/secure-custom-fields/welcome/installation Run this command in your terminal after updating your composer.json to install Secure Custom Fields and other project dependencies. ```bash composer install ``` ```bash composer i ``` -------------------------------- ### Create Distribution Zip Source: https://developer.wordpress.org/secure-custom-fields/contributing/releases Generate the distribution zip file for the release from the current branch. This script performs checks and installs production dependencies. ```bash ./bin/create-release-zip.sh ``` -------------------------------- ### Build Plugin Files with npm Source: https://developer.wordpress.org/secure-custom-fields/contributing Run this command to build the plugin's JavaScript and CSS files. This is typically part of the development setup to compile assets. ```bash npm run build ``` -------------------------------- ### acf_is_beta() Source: https://developer.wordpress.org/secure-custom-fields/code-reference/acf-helper-functions-file Determines if the current ACF installation is a beta or pre-release version. Useful for feature flagging or testing. ```APIDOC ## acf_is_beta() ### Description Check if ACF is a beta-like release. ### Return - **boolean** True if the current install version contains a dash, indicating a alpha, beta or RC release. ``` -------------------------------- ### acf_get_version_when_first_activated() Source: https://developer.wordpress.org/secure-custom-fields/code-reference/acf-helper-functions-file Retrieves the version of ACF that was active when the plugin was first installed. Returns false if this information is unavailable. ```APIDOC ## acf_get_version_when_first_activated() ### Description 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. ### Return - **string|boolean** The (string) version of ACF when it was first activated, or false (boolean) if the version could not be determined. ``` -------------------------------- ### acf_get_post_type_from_request_args() Source: https://developer.wordpress.org/secure-custom-fields/code-reference/acf-internal-post-type-functions-file Gets an ACF post type from request arguments and verifies nonce based on action. Requires the action being performed. ```APIDOC ## acf_get_post_type_from_request_args() Gets an ACF post type from request args and verifies nonce based on action. * @param string $action The action being performed. * @return array|boolean ``` -------------------------------- ### Prepare Release Branch and Run Script Source: https://developer.wordpress.org/secure-custom-fields/contributing/releases Create a new branch from trunk, pull the latest changes, and run the release preparation script. This script builds assets, generates documentation, updates translations, and commits changes. ```bash git checkout trunk && git pull git checkout -b release/x.y.z composer prepare-release ``` -------------------------------- ### acf_get_metadata_by_field() Source: https://developer.wordpress.org/secure-custom-fields/code-reference/acf-meta-functions-file Gets metadata from the database using a field array. ```APIDOC ## acf_get_metadata_by_field() ### Description Gets metadata from the database. ### Parameters * **$post_id** (integer|string) - The post id. * **$field** (array) - The field array. * **$hidden** (boolean) - True if we should return the reference key. ### Returns * mixed - The meta value. ``` -------------------------------- ### acf_get_locale() Source: https://developer.wordpress.org/secure-custom-fields/code-reference/l10n-file Retrieves the current locale of the WordPress installation. This is useful for internationalization purposes to determine the language settings. ```APIDOC ## acf_get_locale() ### Description Returns the current locale. ### Returns * `string` - The current locale. ``` -------------------------------- ### Run Test Suite with Composer Source: https://developer.wordpress.org/secure-custom-fields/contributing Execute this command to run the project's test suite. This is crucial for ensuring code quality and verifying new features or bug fixes. ```bash composer run test ``` -------------------------------- ### acf_setup_meta() Source: https://developer.wordpress.org/secure-custom-fields/code-reference/local-meta-file Adds postmeta to storage. This function is available from ACF version 5.8.0. ```APIDOC ## acf_setup_meta() ### Description Adds postmeta to storage. ### Parameters Refer to ACF_Local_Meta::add() for parameter details. ### Returns array - An array of postmeta data. ``` -------------------------------- ### acf_get_form_data() Source: https://developer.wordpress.org/secure-custom-fields/code-reference/acf-form-functions-file Gets data about the current form. This function retrieves the current data associated with an ACF form. ```APIDOC ## acf_get_form_data() ### Description Gets data about the current form. ### Parameters #### Path Parameters - **name** (string) - Required - The store name. ### Returns - mixed - The form data. ``` -------------------------------- ### acf_prepare_ui_options_page_for_import() Source: https://developer.wordpress.org/secure-custom-fields/code-reference/scf-ui-options-page-functions-file Prepares an ACF 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) - The ACF UI options page array. ### Returns - **array** - The prepared ACF UI options page array. ``` -------------------------------- ### Checkout SVN Repository Source: https://developer.wordpress.org/secure-custom-fields/contributing/releases Check out the secure-custom-fields plugin from the WP.org SVN repository into a separate directory. ```bash svn co https://plugins.svn.wordpress.org/secure-custom-fields secure-custom-fields-svn ``` -------------------------------- ### acf_get_internal_post_type_instance() Source: https://developer.wordpress.org/secure-custom-fields/code-reference/acf-internal-post-type-functions-file Gets an instance of an ACF_Internal_Post_Type. This function is useful for retrieving an object-oriented representation of an internal post type for further manipulation or inspection. ```APIDOC ## acf_get_internal_post_type_instance() ### Description Gets an instance of an ACF_Internal_Post_Type. ### Parameters #### Path Parameters - **post_type** (string) - Required - The ACF internal post type to get the instance for. ### Returns - **ACF_Internal_Post_Type|boolean** - The internal post type class instance, or false on failure. ``` -------------------------------- ### acf_render_field_instructions() Source: https://developer.wordpress.org/secure-custom-fields/code-reference/acf-field-functions-file Renders the instructions for a given field. ```APIDOC ## acf_render_field_instructions() ### Description Render the instructions for a given field. ### Parameters * **array $field** - The field array. ### Returns * void ``` -------------------------------- ### acf_get_internal_post_type() Source: https://developer.wordpress.org/secure-custom-fields/code-reference/acf-internal-post-type-functions-file Get an ACF CPT object as an array. This function retrieves the post type object in an array format, which can be useful for display or processing. ```APIDOC ## acf_get_internal_post_type() ### Description Get an ACF CPT object as an array. ### Parameters #### Path Parameters - **id** (integer) - Required - The post ID being queried. - **post_type** (string) - Required - The post type being queried. ### Returns - **array|false** - The post type object. ``` -------------------------------- ### Create New Tag Locally Source: https://developer.wordpress.org/secure-custom-fields/contributing/releases Locally create a new tag in the SVN repository by copying the 'trunk' directory to a new 'tags/x.y.z' directory. ```bash svn cp trunk tags/x.y.z ``` -------------------------------- ### acf_upgrade_all() Source: https://developer.wordpress.org/secure-custom-fields/code-reference/upgrades-file Executes all available upgrade routines for the site. This function should be called when an upgrade is detected. ```APIDOC ## acf_upgrade_all() ### Description Runs upgrade routines if this site has an upgrade available. ### Returns - void ``` -------------------------------- ### acf_request_args() Source: https://developer.wordpress.org/secure-custom-fields/code-reference/acf-helper-functions-file Retrieves an array of request arguments, applying defaults. This function simplifies accessing data submitted via GET, POST, or COOKIE. ```APIDOC ## acf_request_args() ### Description Returns an array of $_REQUEST values using the provided defaults. ### Parameters * **$args** (array) - An array of args. ### Returns * (array) ``` -------------------------------- ### acf_get_internal_post_type_edit_link() Source: https://developer.wordpress.org/secure-custom-fields/code-reference/acf-internal-post-type-functions-file Gets the edit link for an internal post type. This function provides a direct URL to the edit screen for a specific internal post type. ```APIDOC ## acf_get_internal_post_type_edit_link() ### Description Gets the edit link for an internal post type. ### Parameters #### Path Parameters - **id** (integer|string) - Required - The ID of the internal post type. - **post_type** (string) - Required - The name of the internal post type. ### Returns - **string|false** - The edit link URL, or false on failure. ``` -------------------------------- ### Copy Release Files to SVN Trunk Source: https://developer.wordpress.org/secure-custom-fields/contributing/releases Unzip the distribution file and copy its contents to the 'trunk' folder of your local SVN repository. Use 'svn status' to identify new files and 'svn add' to stage them for commit. ```bash svn status svn add ``` -------------------------------- ### load_item_links Source: https://developer.wordpress.org/secure-custom-fields/code-reference/class-acf-rest-api-file/class-acf-rest-embed-links-file Hook into the rest_prepare_{$type} filters and add links for the object being prepared. ```APIDOC ## load_item_links ### Description Hook into the rest_prepare_{$type} filters and add links for the object being prepared. ### Parameters #### Path Parameters (None specified) #### Query Parameters (None specified) #### Request Body (None specified) ### Method (Not specified in source) ### Endpoint (Not specified in source) ### Parameters #### Path Parameters (None specified) #### Query Parameters (None specified) #### Request Body (None specified) ### Response #### Success Response (200) - **response** (WP_REST_Response) - Description not specified - **item** (WP_Post|WP_User|WP_Term) - Description not specified - **request** (WP_REST_Request) - Description not specified ### Response Example (None specified) ``` -------------------------------- ### acf_get_internal_post_type_post() Source: https://developer.wordpress.org/secure-custom-fields/code-reference/acf-internal-post-type-functions-file Gets a post object from an ACF internal post type. This function allows retrieval of a specific post object associated with an internal post type. ```APIDOC ## acf_get_internal_post_type_post() ### Description Gets a post object from an ACF internal post type. ### Parameters #### Path Parameters - **id** (integer|string) - Required - The post ID, key, or name. - **post_type** (string) - Required - The post type name. ### Returns - **object|boolean** - The post object, or false on failure. ``` -------------------------------- ### acf_prepare_ui_options_page_for_export() Source: https://developer.wordpress.org/secure-custom-fields/code-reference/scf-ui-options-page-functions-file Returns a modified ACF UI options page array, prepared 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) - The ACF UI options page array. ### Returns - **array** - The prepared ACF UI options page array. ``` -------------------------------- ### acf_get_taxonomy_post() Source: https://developer.wordpress.org/secure-custom-fields/code-reference/acf-taxonomy-functions-file Gets a post object for an ACF taxonomy. Available from ACF 6.1, it accepts an ID, key, or name and returns the post object or false on failure. ```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_get_raw_ui_options_pages() Source: https://developer.wordpress.org/secure-custom-fields/code-reference/scf-ui-options-page-functions-file Retrieves an array of all raw SCF UI options pages. Returns an array of raw options page data. ```APIDOC ## acf_get_raw_ui_options_pages() ### Description Returns an array of raw SCF UI options pages. ### Response #### Success Response (array) - Returns an array of raw SCF UI options pages. ``` -------------------------------- ### acf_translate_ui_options_page() Source: https://developer.wordpress.org/secure-custom-fields/code-reference/scf-ui-options-page-functions-file Translates the settings for an SCF UI options page. Returns the translated array. ```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. ### Response #### Success Response (array) - Returns the translated SCF UI options page array. ``` -------------------------------- ### Implement Nav Menu Field in Template Source: https://developer.wordpress.org/secure-custom-fields/features/field/nav_menu/nav_menu-tutorial Check if the Nav Menu Field has a value and retrieve the menu HTML. Ensure 'echo' is set to false to return the HTML instead of outputting it directly. ```php // 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 } ``` -------------------------------- ### acf_get_ui_options_page_from_request_args() Source: https://developer.wordpress.org/secure-custom-fields/code-reference/acf-internal-post-type-functions-file Determines the UI options page from request arguments. This function helps identify the relevant options page based on request parameters. ```APIDOC ## acf_get_ui_options_page_from_request_args() ### Description Determines the UI options page from request arguments. ### Parameters #### Path Parameters - **args** (array) - Required - An array of request arguments. ### Returns - **string|false** - The determined UI options page slug, or false if not found. ``` -------------------------------- ### acf_init() Source: https://developer.wordpress.org/secure-custom-fields/code-reference/api/api-helpers-file Alias of acf()->init() – the core ACF init function. Available since ACF 5.0.0. ```APIDOC ## acf_init() Alias of acf()->init() – the core ACF init function. * @since ACF 5.0.0 ``` -------------------------------- ### acf_debug_start() Source: https://developer.wordpress.org/secure-custom-fields/code-reference/api/api-helpers-file A legacy function for developer debugging. Marked as deprecated and removed in version 6.2.6 for security reasons. ```APIDOC ## acf_debug_start() ### Description A legacy function designed for developer debugging. Removed for security, but keeping the definition in case third party devs have it in their code. ### Returns * (false) - Always returns false. ``` -------------------------------- ### acf_prepare_internal_post_type_for_import() Source: https://developer.wordpress.org/secure-custom-fields/code-reference/acf-internal-post-type-functions-file Prepares an ACF post for the import process. Requires the ACF post array and the post type. ```APIDOC ## acf_prepare_internal_post_type_for_import() Prepares an ACF post for the import process. * @param array $post The ACF post array. * @param string $post_type The post type of the ACF post being imported. * @return array ``` -------------------------------- ### acf_prepare_block() Source: https://developer.wordpress.org/secure-custom-fields/code-reference/blocks-file Prepares a block for rendering by merging its settings and attributes. This function ensures blocks are ready for the render_callback. ```APIDOC ## acf_prepare_block() ### Description Prepares a block for use in render_callback by merging in all settings and attributes. ### Parameters #### Path Parameters - **$block** (array) - The block props. ### Returns - array|boolean ``` -------------------------------- ### acf_prepare_fields_for_import() Source: https://developer.wordpress.org/secure-custom-fields/code-reference/acf-field-functions-file Prepares an array of fields for import. ```APIDOC ## acf_prepare_fields_for_import() ### Description Prepares an array of fields for import. ### Parameters * **array $fields** - An array of fields. ### Returns * array ``` -------------------------------- ### prepare_links Source: https://developer.wordpress.org/secure-custom-fields/code-reference/class-acf-rest-api-file/class-acf-rest-embed-links-file Add links to internal property for subsequent use in \ACF_Rest_Embed_Links::load_item_links(). ```APIDOC ## prepare_links ### Description Add links to internal property for subsequent use in \ACF_Rest_Embed_Links::load_item_links(). ### Parameters #### Path Parameters (None specified) #### Query Parameters (None specified) #### Request Body (None specified) ### Method (Not specified in source) ### Endpoint (Not specified in source) ### Parameters #### Path Parameters - **$post_id** (mixed) - Description not specified #### Query Parameters (None specified) #### Request Body - **field** (array) - Description not specified ``` -------------------------------- ### acf_prepare_post_type_for_import() Source: https://developer.wordpress.org/secure-custom-fields/code-reference/acf-post-type-functions-file Prepares an ACF post type array for the import process. Requires ACF version 6.1 or later. Accepts an ACF post type array and returns the prepared array. ```APIDOC ## acf_prepare_post_type_for_import() ### Description Prepares an ACF post type for the import process. ### Parameters #### Path Parameters - **post_type** (array) - Required - The ACF post type array. ### Returns - **array** ### Since ACF 6.1 ``` -------------------------------- ### acf_prepare_field() Source: https://developer.wordpress.org/secure-custom-fields/code-reference/acf-field-functions-file Prepare a field for input. ```APIDOC ## acf_prepare_field() ### Description Prepare a field for input. ### Parameters * **array $field** - The field array. ### Returns * array ``` -------------------------------- ### acf_import_ui_options_page() Source: https://developer.wordpress.org/secure-custom-fields/code-reference/scf-ui-options-page-functions-file Imports an ACF 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) - The ACF UI options page array. ### Returns - **array** - The imported options page. ``` -------------------------------- ### acf_get_ui_options_pages() Source: https://developer.wordpress.org/secure-custom-fields/code-reference/scf-ui-options-page-functions-file Retrieves an array of SCF UI options pages, optionally filtered by specified arguments. Returns an array of options pages. ```APIDOC ## acf_get_ui_options_pages() ### Description Returns and array of SCF UI options pages for the given $filter. ### Parameters #### Path Parameters - **filter** (array) - Optional - An array of args to filter results by. ### Response #### Success Response (array) - Returns an array of SCF UI options pages. ``` -------------------------------- ### acf_new_admin_notice() Source: https://developer.wordpress.org/secure-custom-fields/code-reference/admin/admin-notices-file Instantiates and returns a new admin notice model. ```APIDOC ## acf_new_admin_notice() ### Description Instantiates and returns a new model. ### Parameters #### Path Parameters - **$data** (array) - Optional data to set. ### Returns - **ACF_Admin_Notice** - The newly created admin notice object. ``` -------------------------------- ### acf_get_full_version() Source: https://developer.wordpress.org/secure-custom-fields/code-reference/api/api-helpers-file Cleans up version strings by removing development suffixes like '-beta1' or '-RC1'. ```APIDOC ## acf_get_full_version() ### Description This function will remove any ‘-beta1’ or ‘-RC1’ strings from a version. ### Parameters * **$version** (string) - The version string to clean. ### Returns * (string) - The cleaned version string. ``` -------------------------------- ### Add Composer Autoloader to Plugin/Theme Source: https://developer.wordpress.org/secure-custom-fields/installation Include this line in your plugin or theme's main file to ensure that Composer-managed dependencies, including Secure Custom Fields, are loaded correctly. ```php require_once plugin_dir_path(dirname(__FILE__)) . 'vendor/autoload.php'; ``` -------------------------------- ### acf_get_ui_options_page_from_request_args() Source: https://developer.wordpress.org/secure-custom-fields/code-reference/acf-internal-post-type-functions-file Retrieves an ACF options page from request arguments and verifies the nonce based on the provided action. This function is essential for validating requests related to ACF options pages. ```APIDOC ## acf_get_ui_options_page_from_request_args() ### Description Gets an ACF options page from request args and verifies nonce based on action. ### Parameters #### Path Parameters - **action** (string) - Required - The action being performed. ### Returns - **array|boolean** - Returns an array representing the options page if successful, or boolean false on failure. ``` -------------------------------- ### acf_get_post_templates() Source: https://developer.wordpress.org/secure-custom-fields/code-reference/acf-post-functions-file Returns available templates for each post type. ```APIDOC ## `acf_get_post_templates()` ### Description Returns available templates for each post type. ### Parameters None ### Returns * `array` - An array containing available templates for each post type. ``` -------------------------------- ### acf_new_instance() Source: https://developer.wordpress.org/secure-custom-fields/code-reference/acf-utility-functions-file Creates a new instance of a given class and stores it in the instances data store. Available since ACF 5.7.10. ```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_get_sites() Source: https://developer.wordpress.org/secure-custom-fields/code-reference/api/api-helpers-file Returns an array of sites for a network. ```APIDOC ## acf_get_sites() ### Description Returns an array of sites for a network. ### Returns * array ``` -------------------------------- ### acf_get_raw_ui_options_page() Source: https://developer.wordpress.org/secure-custom-fields/code-reference/scf-ui-options-page-functions-file Retrieves the raw data for a specific SCF UI options page. Returns the options page data as an array or false if not found. ```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. ### Response #### Success Response (array) - Returns the raw UI options page array. #### Error Response (false) - Returns false if the options page is not found. ``` -------------------------------- ### Manually Load Secure Custom Fields via Composer Source: https://developer.wordpress.org/secure-custom-fields/installation Manually load the Secure Custom Fields plugin by defining its path and including its main file. Adjust the MY_SCF_PATH and MY_SCF_URL constants to match your project structure. ```php if (! class_exists('ACF')) { // Define the path and URL to the Secure Custom Fields plugin. define('MY_SCF_PATH', plugin_dir_path(dirname(__FILE__)) . 'vendor/secure-custom-fields/'); define('MY_SCF_URL', plugin_dir_url(dirname(__FILE__)) . 'vendor/secure-custom-fields/'); // Include the plugin main file. require_once MY_SCF_PATH . 'secure-custom-fields.php'; } ``` -------------------------------- ### acf_get_ui_options_page_post() Source: https://developer.wordpress.org/secure-custom-fields/code-reference/scf-ui-options-page-functions-file Retrieves the post object associated with an SCF UI options page. Returns the post object or false on failure. ```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. ### Response #### Success Response (object) - Returns the post object. #### Error Response (boolean) - Returns false on failure. ``` -------------------------------- ### acf_export_ui_options_page_as_php() Source: https://developer.wordpress.org/secure-custom-fields/code-reference/scf-ui-options-page-functions-file Exports an ACF UI options page into a PHP string 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) - The ACF UI options page array. ### Returns - **string|boolean** - The PHP representation of the options page, or false on failure. ``` -------------------------------- ### acf_upgrade_550() Source: https://developer.wordpress.org/secure-custom-fields/code-reference/upgrades-file 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_has_upgrade() Source: https://developer.wordpress.org/secure-custom-fields/code-reference/upgrades-file Checks if there are any available upgrades for the site. Returns true if an upgrade is available, false otherwise. ```APIDOC ## acf_has_upgrade() ### Description Returns true if this site has an upgrade available. ### Returns - boolean: True if an upgrade is available, false otherwise. ``` -------------------------------- ### Retrieve Option in Classic Theme Source: https://developer.wordpress.org/secure-custom-fields/tutorials/first-options-page Use `get_option()` to retrieve a saved option value in a classic WordPress theme. Ensure the option name matches the field key used in SCF. ```php ``` -------------------------------- ### acf_prepare_taxonomy_for_import() Source: https://developer.wordpress.org/secure-custom-fields/code-reference/acf-taxonomy-functions-file Prepares an ACF taxonomy array for the import process. Available from ACF 6.1. ```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** ``` -------------------------------- ### acf_version_compare() Source: https://developer.wordpress.org/secure-custom-fields/code-reference/api/api-helpers-file Compares two version numbers, similar to PHP's version_compare(), but with additional ACF-specific functionality. ```APIDOC ## acf_version_compare() ### Description Similar to the version_compare() function but with extra functionality. ### Parameters * **$left** (string) - The left version number to compare. * **$compare** (string) - The comparison operator (e.g., '==', '>', '<'). * **$right** (string) - The right version number to compare. ### Returns * (boolean) - True if the comparison is met, false otherwise. ``` -------------------------------- ### acf_get_bidirectional_field_settings_instruction_text() Source: https://developer.wordpress.org/secure-custom-fields/code-reference/acf-bidirectional-functions-file Returns the translated instructional text for the message field for the bidirectional field settings. ```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_switch_stores() Source: https://developer.wordpress.org/secure-custom-fields/code-reference/acf-utility-functions-file Handles switching data stores, typically used in multisite environments. Available since ACF 5.7.11. ```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** (int) - Required - Previous blog ID. ### Returns - void ``` -------------------------------- ### acf_get_option_meta() Source: https://developer.wordpress.org/secure-custom-fields/code-reference/acf-meta-functions-file Returns an array of meta for the given wp_option name prefix in the same format as get_post_meta(). ```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 * **$prefix** (string) - The wp_option name prefix. ### Returns * array - An array of option meta data. ``` -------------------------------- ### acf_prepare_fields_for_import() Source: https://developer.wordpress.org/secure-custom-fields/code-reference/acf-field-functions-file Prepares an array of fields for import by modifying them into a format suitable for deserialization and database insertion. ```APIDOC ## acf_prepare_fields_for_import() ### Description Returns a modified array of fields ready for import. ### Parameters #### Path Parameters - **fields** (array) - Required - An array of fields. ### Returns - **array** - The modified array of fields. ``` -------------------------------- ### Add Composer Configuration for SCF Source: https://developer.wordpress.org/secure-custom-fields/installation Add this configuration to your composer.json file to manage Secure Custom Fields as a project dependency. This ensures proper versioning and autoloading. ```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_image_sizes() Source: https://developer.wordpress.org/secure-custom-fields/code-reference/api/api-helpers-file Retrieves an array of all available image sizes configured in WordPress. ```APIDOC ## acf_get_image_sizes() ### Description This function will return an array of available image sizes. ### Parameters * n/a ### Returns * (array) - An array containing image size names and their dimensions. ``` -------------------------------- ### hook_link_handlers Source: https://developer.wordpress.org/secure-custom-fields/code-reference/class-acf-rest-api-file/class-acf-rest-embed-links-file Hook into all REST-enabled post type, taxonomy, and the user controllers in order to prepare links. ```APIDOC ## hook_link_handlers ### Description Hook into all REST-enabled post type, taxonomy, and the user controllers in order to prepare links. ### Method (Not specified in source) ### Endpoint (Not specified in source) ``` -------------------------------- ### acf_add_admin_notice() Source: https://developer.wordpress.org/secure-custom-fields/code-reference/admin/admin-notices-file Creates and returns a new admin notice. ```APIDOC ## acf_add_admin_notice() ### Description Creates and returns a new notice. ### Parameters #### Path Parameters - **$text** (string) - The admin notice text. - **$type** (string) - The type of notice (warning, error, success, info). - **$dismissible** (boolean) - Is this notification dismissible (default true) (since 5.11.0). - **$persisted** (boolean) - Store once a notice has been dismissed per user and prevent showing it again. (since ACF 6.1.0). ### Returns - **ACF_Admin_Notice** - The newly created admin notice object. ``` -------------------------------- ### acf_doing() Source: https://developer.wordpress.org/secure-custom-fields/code-reference/api/api-helpers-file Indicates the current task or event ACF is performing. ```APIDOC ## acf_doing() ### Description This function will tell ACF what task it is doing. ### Parameters * **$event** (string) - Required * **context** (string) - Required ### Returns * n/a ``` -------------------------------- ### acf_get_ui_options_page() Source: https://developer.wordpress.org/secure-custom-fields/code-reference/scf-ui-options-page-functions-file Retrieves a specific SCF UI options page by its ID. Returns the options page as an array or false if not found. ```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. ### Response #### Success Response (array) - Returns the UI options page array. #### Error Response (false) - Returns false if the options page is not found. ``` -------------------------------- ### acf_prepare_fields_for_export() Source: https://developer.wordpress.org/secure-custom-fields/code-reference/acf-field-functions-file Prepares an array of fields for export. ```APIDOC ## acf_prepare_fields_for_export() ### Description Prepares an array of fields for export. ### Parameters * **array $fields** - An array of fields. ### Returns * array ``` -------------------------------- ### acf_is_ui_options_page() Source: https://developer.wordpress.org/secure-custom-fields/code-reference/scf-ui-options-page-functions-file Checks if the provided parameters match an ACF UI options page. Returns true if it matches, false otherwise. ```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. ### Response #### Success Response (boolean) - Returns true if the parameters match an ACF UI options page. ``` -------------------------------- ### scf_get_admin_beta_features_url() Source: https://developer.wordpress.org/secure-custom-fields/code-reference/admin/beta-features-file Retrieves the admin URL for the beta features page. ```APIDOC ## scf_get_admin_beta_features_url() ### Description This function will return the admin URL to the beta features page. ### Returns - **string** - The URL to the beta features page. ``` -------------------------------- ### acf_render_field_wrap_description() Source: https://developer.wordpress.org/secure-custom-fields/code-reference/deprecated-file Renders the field’s instructions. This function is deprecated since ACF 5.6.5. ```APIDOC ## acf_render_field_wrap_description() ### Description Renders the field’s instructions. ### Parameters * **$field** (array) - The field array. ### Deprecated This function is deprecated since ACF 5.6.5. ``` -------------------------------- ### acf_get_user_setting() Source: https://developer.wordpress.org/secure-custom-fields/code-reference/api/api-helpers-file Retrieves a user setting. ```APIDOC ## acf_get_user_setting() ### Description description ### Parameters * `$post_id` (int) ### Returns * `$post_id` (int) ``` -------------------------------- ### acf_render_admin_notices() Source: https://developer.wordpress.org/secure-custom-fields/code-reference/admin/admin-notices-file Renders all admin notices HTML. ```APIDOC ## acf_render_admin_notices() ### Description Renders all admin notices HTML. ### Returns - **void** - This function does not return a value. ``` -------------------------------- ### acf_prepare_field_for_import() Source: https://developer.wordpress.org/secure-custom-fields/code-reference/acf-field-functions-file Prepares a single field for import. ```APIDOC ## acf_prepare_field_for_import() ### Description Prepares a single field for import. ### Parameters * **array $field** - The field to prepare. ### Returns * array ``` -------------------------------- ### SCF_Rest_Types_Endpoint Class Methods Source: https://developer.wordpress.org/secure-custom-fields/code-reference/rest-api/class-acf-rest-types-endpoint-file This section outlines the various methods available within the SCF_Rest_Types_Endpoint class, detailing their purpose, parameters, and return values. ```APIDOC ## Class SCF_Rest_Types_Endpoint * Extends the /wp/v2/types endpoint to include SCF fields and source filtering. * @since SCF 6.5.0 ### Methods #### __construct Initialize the class and register hooks. * @since SCF 6.5.0 * @since 6.7.0 Simplified hook registration. #### is_valid_source Validate source parameter. * @since 6.7.0 * @param string $source The source value to validate. * @return bool True if valid, false otherwise. #### filter_types_request Filter post types requests for individual post type requests. * @since SCF 6.5.0 * @since 6.7.0 Use is_valid_source() helper method. * @param mixed $response The current response. * @param array $handler The handler for the route. * @param WP_REST_Request $request The request object. * @return mixed The response or WP_Error. #### filter_post_type Filter individual post type in the response. * @since SCF 6.5.0 * @since 6.7.0 Use is_valid_source() helper method. * @param WP_REST_Response $response The response object. * @param WP_Post_Type $post_type The post type object. * @param WP_REST_Request $request The request object. * @return WP_REST_Response|null The filtered response or null. #### get_source_post_types Get post types for a specific source. * @since SCF 6.5.0 * @param string $source The source to get post types for (core, scf, other). * @return array An array of post type names for the specified source. #### register_extra_fields Register extra SCF fields for the post types endpoint. * @since SCF 6.5.0 * @return void #### get_scf_fields Get SCF fields for a post type. * @since SCF 6.5.0 * @param array $post_type_object The post type object. * @return array Array of field data. #### get_scf_post_id Get the SCF internal post ID for a post type. * @since SCF 6.8.3 * @param array $post_type_object The post type object. * @return int|null The post ID if managed by SCF, null otherwise. #### get_field_schema Get the schema for the SCF fields. * @since SCF 6.5.0 * @return array The schema for the SCF fields. #### register_parameters Register the source parameter for the post types endpoint. * @since SCF 6.5.0 #### get_source_param_definition Get the source parameter definition * @since SCF 6.5.0 * @since 6.7.0 Use VALID_SOURCES constant. * @return array Parameter definition #### add_parameter_to_endpoints Add source parameter directly to the endpoints for proper documentation * @since SCF 6.5.0 * @param array $endpoints The REST API endpoints. * @return array Modified endpoints #### add_collection_params Add source parameter to the collection parameters for the types endpoint. * @since SCF 6.5.0 * @param array $query_params JSON Schema-formatted collection parameters. * @return array Modified collection parameters. #### clean_types_response Clean up null entries from the response * @since SCF 6.5.0 * @param array $response The response data. * @param WP_REST_Server $server The REST server instance. * @param WP_REST_Request $request The original request. * @return array The filtered response data. ``` -------------------------------- ### acf_load_textdomain() Source: https://developer.wordpress.org/secure-custom-fields/code-reference/l10n-file Loads the plugin's translated strings, similar to the core WordPress function `load_plugin_textdomain()`. This function is essential for making your plugin's text translatable. ```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_raw_setting() Source: https://developer.wordpress.org/secure-custom-fields/code-reference/api/api-helpers-file Retrieves the raw value of a setting. ```APIDOC ## acf_raw_setting() ### Description Retrieves the raw value of a setting. Alias of acf()->get_setting(). ### Returns * n/a ``` -------------------------------- ### acf_upload_files() Source: https://developer.wordpress.org/secure-custom-fields/code-reference/api/api-helpers-file Walks through $_FILES data and uploads each found file. ```APIDOC ## acf_upload_files() ### Description This function will walk through the $_FILES data and upload each found. ### Parameters * `array $ancestors` An internal parameter, not required. ``` -------------------------------- ### acf_trash_ui_options_page() Source: https://developer.wordpress.org/secure-custom-fields/code-reference/scf-ui-options-page-functions-file Moves an ACF UI options page to the trash. Returns true if the operation was successful. ```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. ### Response #### Success Response (boolean) - Returns true if the options page was trashed. ``` -------------------------------- ### acf_file_input() Source: https://developer.wordpress.org/secure-custom-fields/code-reference/acf-input-functions-file Renders the HTML for a file input field. This function directly outputs the HTML. ```APIDOC ## acf_file_input() ### Description Renders the HTML of a file input. ### Parameters #### Path Parameters - **attrs** (array) - Required - The array of attrs. ### Returns - void - echos out value. ``` -------------------------------- ### acf_get_setting() Source: https://developer.wordpress.org/secure-custom-fields/code-reference/api/api-helpers-file Retrieves a specific setting, with an optional default value. ```APIDOC ## acf_get_setting() ### Description Alias of acf()->get_setting(). Retrieves a specific setting, with an optional default value. ### Parameters * **$name** (string) - The name of the setting to test. * **$value** (string) - An optional default value for the setting if it doesn’t exist. ### Returns * n/a ``` -------------------------------- ### acf_process_block_toolbar_fields() Source: https://developer.wordpress.org/secure-custom-fields/code-reference/blocks-file Prepares a list of fields for localization and use as block toolbar fields on the frontend. This function ensures fields are correctly formatted for JavaScript. ```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 * @param array $fields List of fields. Each field can be a string (field name) or an associative array with keys: * $field_name (string) - The name of the field to display in the toolbar. * $field_icon (string) - HTML tag for the field icon. Defaults to the first field's icon. * $field_label (string) - Label for the toolbar button. ### Returns * @return array The array of fields, prepared for JS localization. ``` -------------------------------- ### acf_get_location_screen() Source: https://developer.wordpress.org/secure-custom-fields/code-reference/locations-file Retrieves an array of screen arguments that are used for matching location rules. Provides context about the current view. ```APIDOC ## acf_get_location_screen() ### Description Returns an array of screen args to be used against matching rules. ### Parameters #### Path Parameters - **$screen** (array) - Required - The screen args. - **$deprecated** (array) - Deprecated. ### Returns - array - An array of screen arguments. ``` -------------------------------- ### acf_get_instance() Source: https://developer.wordpress.org/secure-custom-fields/code-reference/acf-utility-functions-file Retrieves an existing instance for a given class from the instances data store. Available since ACF 5.7.10. ```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_parse_markdown() Source: https://developer.wordpress.org/secure-custom-fields/code-reference/api/api-helpers-file A basic regex-based Markdown parser function. ```APIDOC ## acf_parse_markdown() ### Description A very basic regex-based Markdown parser function based off slimdown. ### Parameters * $text (string) The string to parse. ### Returns * string ``` -------------------------------- ### acf_walk_select_input() Source: https://developer.wordpress.org/secure-custom-fields/code-reference/acf-input-functions-file Returns the HTML for the choices within a select input. This is used internally for rendering select options. ```APIDOC ## acf_walk_select_input() ### Description Returns the HTML of a select input’s choices. ### Parameters #### Path Parameters - **choices** (array) - Required - The choices to walk through. - **values** (array) - Required - The selected choices. - **depth** (array) - Required - The current walk depth. ### Returns - string - The HTML string of the select input choices. ``` -------------------------------- ### acf_nonce_input() Source: https://developer.wordpress.org/secure-custom-fields/code-reference/api/api-helpers-file Creates and echoes a basic nonce input field. Available since ACF 5.6.0. ```APIDOC ## acf_nonce_input() This function will create and echo a basic nonce input * @since ACF 5.6.0 * @param string $nonce The nonce parameter string. ``` -------------------------------- ### acf_get_users() Source: https://developer.wordpress.org/secure-custom-fields/code-reference/acf-user-functions-file Retrieves a list of users, similar to WordPress's get_users() but with additional ACF functionality. Accepts an array of query arguments. ```APIDOC ## acf_get_users() ### Description Similar to the get_users() function but with extra functionality. ### Parameters #### Arguments - **$args** (array) - The query args. ### Returns - array - An array of user objects. ``` -------------------------------- ### acf_prepare_post_type_for_export() Source: https://developer.wordpress.org/secure-custom-fields/code-reference/acf-post-type-functions-file Prepares an ACF post type array for export. Requires ACF version 6.1 or later. Accepts an ACF post type array and returns the modified array ready for export. ```APIDOC ## acf_prepare_post_type_for_export() ### Description Returns a modified ACF post type ready for export. ### Parameters #### Path Parameters - **post_type** (array) - Required - The ACF post type array. ### Returns - **array** ### Since ACF 6.1 ``` -------------------------------- ### acf_has_setting() Source: https://developer.wordpress.org/secure-custom-fields/code-reference/api/api-helpers-file Checks if a specific setting exists. ```APIDOC ## acf_has_setting() ### Description Alias of acf()->has_setting(). Checks if a specific setting exists. ### Parameters * **$name** (string) - Name of the setting to check for. ### Returns * boolean ``` -------------------------------- ### acf_get_browser() Source: https://developer.wordpress.org/secure-custom-fields/code-reference/api/api-helpers-file Returns the name of the current browser. ```APIDOC ## acf_get_browser() ### Description Returns the name of the current browser. ### Returns * string ``` -------------------------------- ### get_schema Source: https://developer.wordpress.org/secure-custom-fields/code-reference/rest-api/class-acf-rest-api-file Dynamically generates the schema for the current REST API request. ```APIDOC ## get_schema ### Description Dynamically generate the schema for the current request. ### Method Not specified (internal class method) ### Endpoint Not applicable (internal class method) ### Parameters None specified ### Response #### Success Response (200) - **array**: Schema details for the current request. ``` -------------------------------- ### acf_get_meta_instance() Source: https://developer.wordpress.org/secure-custom-fields/code-reference/acf-meta-functions-file 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 * **$type** (string) - The meta type as decoded from the post ID. ### Returns * object|null - The ACF meta instance or null if not found. ``` -------------------------------- ### acf_preview_value() Source: https://developer.wordpress.org/secure-custom-fields/code-reference/acf-value-functions-file Return a human friendly ‘preview’ for a given field value. ```APIDOC ## acf_preview_value() ### Description Return a human friendly ‘preview’ for a given field value. ### Parameters * **$value** (mixed) - Required - The new value. * **$post_id** (int|string) - Required - The post id. * **$field** (array) - Required - The field array. ### Returns * **boolean** - A preview of the field value. ``` -------------------------------- ### acf_prepare_taxonomy_for_export() Source: https://developer.wordpress.org/secure-custom-fields/code-reference/acf-taxonomy-functions-file Prepares an ACF taxonomy array for export. Available from ACF 6.1. ```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** ``` -------------------------------- ### acf_get_view() Source: https://developer.wordpress.org/secure-custom-fields/code-reference/api/api-helpers-file Loads a file from the ‘admin/views’ folder and allows variables to be passed through. Available since ACF 5.0.0. ```APIDOC ## acf_get_view() This function will load in a file from the ‘admin/views’ folder and allow variables to be passed through * @since ACF 5.0.0 * @param string $view_path * @param array $view_args ``` -------------------------------- ### acf_register_store() Source: https://developer.wordpress.org/secure-custom-fields/code-reference/acf-utility-functions-file Registers a new data store with a specified name and initial data. Available since ACF 5.7.10. ```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 object. ``` -------------------------------- ### acf_build_bidirectional_relationship_field_target_args() Source: https://developer.wordpress.org/secure-custom-fields/code-reference/acf-bidirectional-functions-file Builds valid fields for a bidirectional relationship for select2 display. ```APIDOC ## acf_build_bidirectional_relationship_field_target_args() ### Description Build valid fields for a bidirectional relationship for select2 display. ### Parameters #### Path Parameters - **$results** (array) - The original results array. - **$options** (array) - The options provided to the select2 AJAX search. ### Returns - array ``` -------------------------------- ### acf_upgrade_550_termmeta() Source: https://developer.wordpress.org/secure-custom-fields/code-reference/upgrades-file Upgrades all termmeta data previously saved in the `wp_options` table 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_upgrade_500() Source: https://developer.wordpress.org/secure-custom-fields/code-reference/upgrades-file Performs the upgrade routine for version 5.0.0, which involves changes to post types for field groups and fields. ```APIDOC ## acf_upgrade_500() ### Description Version 5 introduces new post types for field groups and fields. ### Returns - void ```