Support

Account

Home Forums Backend Issues (wp-admin) Disable ACF upgrade for clients

Solving

Disable ACF upgrade for clients

  • Is there any way to disable the upgrade notification for ACF when I’ve included it in my own plugin for a client?

    Directions for hiding the ACF admin menu work fine, but when a new version is released, I get an update notification in the admin bar. Visiting the upgrade page, though, shows all my plugins (and WP itself) as being up-to-date. Not a great user experience.

    I’d love a filter that hides the update notification when I’ve embedded it into my own work.

    Thanks!

  • I used this in my functions.php file:

    add_filter('site_transient_update_plugins', 'my_remove_update_nag');
    function my_remove_update_nag($value) {
     unset($value->response[ 'advanced-custom-fields-pro/acf.php' ]);
     return $value;
    }

    the “my” can be whatever you want. 🙂

  • If you’re not using the “pro” version you might have to alter the path to the plugin. 🙂

  • Hmm…no dice. I don’t get an error, I just keep getting the update nag in the dashboard. Here’s my code:

    
    // Hide ACF from admin menu outside of development
    if ( WP_ENV !== 'development' ) {
      add_filter( 'acf/settings/show_admin', '__return_false' );
      add_filter( 'site_transient_update_plugins', 'ext_core_acf_remove_update_notification' );
    }
    // Disable ACF update notifications
    // http://support.advancedcustomfields.com/forums/topic/disable-acf-upgrade-for-clients/
    function ext_core_acf_remove_update_notification( $value ) {
      unset( $value->response[ plugin_basename( __FILE__ ) . 'acf/acf.php' ] );
      return $value;
    }
    

    (That other filter removes ACF from the dashboard. Both apply only outside the development environment.)

    I should mention that I’m including ACF Pro in a private plugin for a client, so it’s being included according to the official instructions.

  • Anybody?

    I should mention, I am using the Pro version…just put it in a custom directory according to instructions.

  • Ditto, I would love an answer on this question as well!

  • I’ve tried several approaches… no love. Looking forward to the solution!

  • Is there still no solution for this? Would love to hide the update notice.

  • I believe that the problem is that everyone is including the plugin differently. Some are in plugins, some are in themes, etc.

    Here’s the code I just used to get the update nag to go away in my theme:

    
    function one_up_stop_acf_update_notifications( $value ) {
    
    	// remove the plugin from the response so that it is not reported
    	unset( $value->response[ trim( get_template_directory(), '/' ) .'/inc/acf/acf.php' ] );
    	return $value;
    }
    add_filter( 'site_transient_update_plugins', 'one_up_stop_acf_update_notifications', 11 );
    

    ACF is located in /mytheme/inc/acf/, so I use get_template_directory() to get the theme (or parent theme) directory, and I make sure to trim off the ‘/’ because it should not be on the beginning of the string. I then unset that, and it works.

    For plugins, you would need to use something like plugin_dir_path

    Here’s a screen shot showing that I need to upgrade ACF, but there are no nag badges:
    Screen shot of ACF with no nag badges

    ===
    Edit:

    Something clicked after I hit submit…

    Here is the ‘response’ part of the object that is being filtered via ‘site_transient_update_plugins’:

    
        [response] => Array
            (
                [Users/j/Documents/Projects/OWD/JP2015/wp/wp-content/themes/one-up/inc/acf/acf.php] => stdClass Object
                    (
                        [slug] => Users
                        [new_version] => 5.2.1
                        [url] => http://www.advancedcustomfields.com/
                        [package] => 
                    )
    
            )
    

    Each key in that array is the path to the plugin/theme that needs to be updated. If you are following the official instructions, then you should set your filter to unset the same thing you’re setting in step 1. This is what I am using:

    
    // 1. customize ACF path
    function my_acf_settings_path( $path ) {
     
        // update path
        $path = get_template_directory() . '/inc/acf/';
        
        // return
        return $path;
    }
    add_filter( 'acf/settings/path', 'my_acf_settings_path' );
    

    And you can see from my original post that is pretty much what I am removing from the response array.

  • Thank you for the detailed response and thorough troubleshooting. I followed the official instructions and included the files in my theme. Everything works as expected and the nag is gone. Thanks again.

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

The topic ‘Disable ACF upgrade for clients’ is closed to new replies.