Home › Forums › Backend Issues (wp-admin) › Disable ACF upgrade for clients › Reply To: Disable ACF upgrade for clients
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:
===
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.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
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 Privacy Policy. If you continue to use this site, you consent to our use of cookies.