Support

Account

Home Forums ACF PRO Issues when including ACF Pro in a theme

Solved

Issues when including ACF Pro in a theme

  • Hey guys,

    I’ve had a look over the forums but I couldn’t find anything. I’ve got two issues when it comes to including the ACF Pro plugin in a theme.

    require_once( INCLUDES . '/plugins/acf-pro/acf.php');
    
    add_filter('acf/settings/path', 'my_acf_settings_path');
     
    function my_acf_settings_path( $path ) {
     
    	$path = get_bloginfo('stylesheet_directory') . '/inc/plugins/acf-pro/';
    	
    	return $path;
    	
    }
    
    add_filter('acf/settings/dir', 'my_acf_settings_dir');
     
    function my_acf_settings_dir( $dir ) {
     
    	$dir = get_stylesheet_directory_uri() . '/inc/plugins/acf-pro/';
    	
    	return $dir;
    	
    }

    The plugin is included correctly and works for the most part but I’ve got two issues.

    1. Since you’ve released the 5.0.5 update I’m getting an update notification on the dashboard. I’m looking to include ACF PRO in a premium theme. Is there a way I can remove these notifications?

    Update Notification

    2. I’m getting blank screens on the Import/Export and Update sections. The Custom Fields are displaying correctly though. Do you know what is causing this?

    Blank Screens

    If I install the plugin using the general methods instead of including it everything works perfectly. I’m probably missing something in the documentation but I’ve gone over it a couple of times.

    Thanks.

  • I’m experiencing the same problem.

    The only way I can see to disable the update notification is really hacky — to change the version number on line 64 of acf.php to something unfeasibly high (so the the current version is always higher than the stable version), and to manage updates manually.

    It would be great if there were a way to disable updates when including ACF Pro in a premium theme.

  • Hi guys

    Thanks for the thread. I like the idea of a filter to disable updates so I’ll add that to my to-do list.

    As for the path issue. Can you please debug your code and double check that the url/path is 100% correct?

  • That’s awesome, Thanks Elliot!

  • I’m also experiencing problems.
    The path is correct (see images at the bottom of this post).
    What am I doing wrong?

    Here is my code:

    include_once( 'acf/acf.php' );
    
    add_filter('acf/settings/path', 'my_acf_settings_path');
     
    function my_acf_settings_path( $path ) {
     
    	// update path
    	$path = get_bloginfo('stylesheet_directory') . '/acf/';
    	
    	// return
    	return $path;
    	
    }
    
    add_filter('acf/settings/dir', 'my_acf_settings_dir');
     
    function my_acf_settings_dir( $dir ) {
     
    	// update path
    	$dir = get_stylesheet_directory_uri() . '/acf/';
    	
    	
    	// return
    	return $dir;
    	
    }

    Errors: http://www.patrickheiloo.nl/resources/acf/error_codes.png

    Empty import/export: http://www.patrickheiloo.nl/resources/acf/empty_screen.png

    File structure: http://www.patrickheiloo.nl/resources/acf/structure.png

  • Hi @patrick Heiloo

    Thanks for the screenshots. I think the path setting may not be correct because it starts with ‘http’. A path should not be a web url, but an absolute path to the file.

    Perhaps try using get_stylesheet_directory() instead of get_bloginfo('stylesheet_directory')

  • Hi @elliot Condon

    Yes that’s it, problem solved!
    Thanks for your help 🙂

Viewing 7 posts - 1 through 7 (of 7 total)

You must be logged in to reply to this topic.