function your_plugins_shortcode($attr) { global $current_user; if (isset($_POST['unregister'])) { $plugin_access = get_usermeta($current_user->ID, 'plugin_access'); $id = $_POST['plugin']; $user_sites = $plugin_access[$id]['sites']; $sites = $_POST['site']; foreach ($sites as $site) { $key = array_search($site, $user_sites); if ($key) { unset($user_sites[$key]); } } $plugin_access[$id]['sites'] = $user_sites; update_usermeta($current_user->ID, 'plugin_access', $plugin_access); } $plugin_access = get_usermeta($current_user->ID, 'plugin_access'); $key = $plugin_access['key']; $plugins = Plugins::plugins_for_current_user(); include "app/views/shortcodes/your-plugins.php"; }