there is no sens in forcing the logged_in, because it's already the default * * [custer_change_id] -> default (author) * [custer_change_id author] -> author * [custer_change_id off] -> reset to logged_in * */ function shortcode_change_id($options) { /* * set the default value for option * currently it can only be author * */ $option = 'author'; if (is_array($options)) { $option = reset($options); } if (!is_string($option)) { return; } if ($option === 'author') { $id = \CUSTER\get_author_id(); Custer::set_current_user_backup(); wp_set_current_user($id); } else if ($option === 'off') { $id = Custer::reset_current_user_backup(); wp_set_current_user($id); } else return; } add_shortcode('custer_change_id', __NAMESPACE__.'\shortcode_change_id'); ?>