options; $t = esc_sql( "_transient_timeout_%_age_gate%" ); $sql = $wpdb->prepare ( " SELECT option_name, option_value FROM $options WHERE option_name LIKE '%s' ", $t ); $transients = $wpdb->get_results( $sql ); foreach ($transients as $transient) { // Strip away the WordPress prefix in order to arrive at the transient key. $key = str_replace( '_transient_timeout_', '', $transient->option_name ); // Now that we have the key, use WordPress core to the delete the transient. delete_transient( $key ); } // Remove capabilties global $wp_roles; foreach([ 'ag_manage_restrictions', 'ag_manage_appearance', 'ag_manage_advanced', 'ag_manage_messaging', 'ag_manage_settings', 'ag_manage_set_content_restriction', 'ag_manage_set_content_bypass', 'ag_manage_set_custom_age' ] as $cap){ foreach ($wp_roles->roles as $key => $value) { $wp_roles->remove_cap( $key, $cap ); } } wp_cache_flush();