public function is_uploading_allowed() { if (!isset($this->uploading_allowed)) { require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php'; require_once WP_Installer()->plugin_path() . '/includes/installer-upgrader-skins.php'; $upgrader_skins = new Installer_Upgrader_Skins(); //use our custom (mute) Skin $upgrader = new Plugin_Upgrader($upgrader_skins); ob_start(); $res = $upgrader->fs_connect(array(WP_CONTENT_DIR, WP_PLUGIN_DIR)); ob_end_clean(); if (!$res || is_wp_error($res)) { $this->uploading_allowed = false; } else { $this->uploading_allowed = true; } } return $this->uploading_allowed; }