首页 > 解决方案 > 有什么方法可以在 ACF 图像字段中添加默认图像

问题描述

当我尝试使用 ACF 创建图像字段时,我想在 WordPress 管理员中添加默认图像选项(我们可以说在图像字段中设置默认选项)非常感谢您提前

标签: wordpressadvanced-custom-fields

解决方案


你可以把下面的代码放在你的functions.php中

add_action('acf/render_field_settings/type=image', 'add_defult_image_field');
    function add_defult_image_field($field) {
        acf_render_field_setting( $field, array(
            'label'         => 'Defult Image',
            'instructions'      => 'Appears when creating a new post',
            'type'          => 'image',
            'name'          => 'defult_value',
        ));
    }

推荐阅读