acf/input/admin_enqueue_scripts

Description

Used to enqueue scripts and styles on pages where ACF fields appear.

This action is similar to the WordPress admin_enqueue_scripts, except that it is only fired on pages where ACF fields appear – such as when editing posts, users, taxonomy terms, options pages and front-end forms.

Changelog

  • Added in version 5.0.0

Example

This example demonstrates how to enqueue custom styles and scripts for your fields.

functions.php

<?php
add_action('acf/input/admin_enqueue_scripts', 'my_acf_admin_enqueue_scripts');
function my_acf_admin_enqueue_scripts() {
    wp_enqueue_style( 'my-acf-input-css', get_stylesheet_directory_uri() . '/css/my-acf-input.css', false, '1.0.0' );
    wp_enqueue_script( 'my-acf-input-js', get_stylesheet_directory_uri() . '/js/my-acf-input.js', false, '1.0.0' );
}

We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Cookie Policy. If you continue to use this site, you consent to our use of cookies.