Support

Account

Home Forums Backend Issues (wp-admin) How to run ACF plugin once mytheme already ACF pro plugin

Solved

How to run ACF plugin once mytheme already ACF pro plugin

  • My theme has already ACF plugin inside My-parent-theme/include/acf.pro. Once I installed ACF free plugin notice showed as your theme has already ACF plugin. please deactive acf plugin. this massage from parent code inside my-parent-theme/include/addons.

    my question is:
    Can I Show admin setting without installed the ACF free plugin inside my child-theme active. I’ve chek on the documentation

    here is my code inside the function:
    if ( ! has_filter( 'acf/settings/show_admin' ) ) {
    	add_filter('acf/settings/show_admin', '__return_true');
    }

    please, help how to start your plugin in my child if my theme has already one.

  • Solved by myself.

    just find the correct directories and put on child.

    /*ACF*/
    // 1. customize ACF path
    add_filter('acf/settings/path', 'my_acf_pro_settings_path');
    function my_acf_pro_settings_path( $path ) {
        $path = get_template_directory() . '/includes/acf-pro/';
        return $path;
    }
    
    // 2. customize ACF dir
    add_filter('acf/settings/dir', 'my_acf_pro_settings_dir');
     
    function my_acf_pro_settings_dir( $dir ) {
        $dir = get_template_directory_uri() . '/includes/acf-pro/';
        return $dir;
    }
    
    // 3. Hide ACF field group menu item
    if ( ! has_filter( 'acf/settings/show_admin' ) ) {
    	add_filter('acf/settings/show_admin', '__return_true');
    }
    
    // 4. Include ACF
    include_once( get_template_directory() . '/includes/acf-pro/acf.php' );
Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.