Example #1
0
 function modify_plugin_update($transient)
 {
     // bail early if no response (dashboard showed an error)
     if (!isset($transient->response)) {
         return $transient;
     }
     // vars
     $basename = acf_get_setting('basename');
     $show_updates = acf_get_setting('show_updates');
     // bail early if not a plugin (included in theme)
     if (!acf_is_plugin_active()) {
         $show_updates = false;
     }
     // bail early if no show_updates
     if (!$show_updates) {
         // remove from transient
         unset($transient->response[$basename]);
         // return
         return $transient;
     }
     // get update
     $update = acf_maybe_get($transient->response, $basename);
     // filter
     $update = apply_filters('acf/updates/plugin_update', $update, $transient);
     // update
     if ($update) {
         $transient->response[$basename] = $update;
     } else {
         unset($transient->response[$basename]);
     }
     // return
     return $transient;
 }
 function admin_menu()
 {
     // bail early if no show_admin
     if (!acf_get_setting('show_admin')) {
         return;
     }
     // bail early if no show_updates
     if (!acf_get_setting('show_updates')) {
         return;
     }
     // bail early if not a plugin (included in theme)
     if (!acf_is_plugin_active()) {
         return;
     }
     // add page
     $page = add_submenu_page('edit.php?post_type=acf-field-group', __('Updates', 'acf'), __('Updates', 'acf'), acf_get_setting('capability'), 'acf-settings-updates', array($this, 'html'));
     // actions
     add_action('load-' . $page, array($this, 'load'));
 }