plugin ) ) { return $update; } return isset( Registry::flagged_files()[ $item->plugin ] ) ? false : $update; } /** * Refuses to download an update for a held plugin, so the Update button, bulk update and * WP-CLI all stop with an explanation instead of installing it. The update stays listed, so * nothing about WordPress's own update data is changed. * * @param bool|\WP_Error $reply Whether to short-circuit the download. * @param string $package Package URL. * @param \WP_Upgrader $upgrader The upgrader. * @param array $hook_extra Extra details, including the plugin file being updated. * @return bool|\WP_Error */ public static function block_held_download( $reply, $package, $upgrader, $hook_extra = array() ) { if ( false !== $reply || ! self::enabled() || empty( $hook_extra['plugin'] ) ) { return $reply; } $flagged = Registry::flagged_files(); $file = (string) $hook_extra['plugin']; if ( ! isset( $flagged[ $file ] ) ) { return $reply; } return new \WP_Error( 'afbuw_held', Notifier::describe( $flagged[ $file ]['slug'], $flagged[ $file ] ) . ' ' . __( 'AFB Update Watch is holding this update until you review it and release the hold.', 'afb-update-watch' ) ); } }