I have some customisation on my Child-Theme’s functions.php that calls the Site URL. I’ve received the snippet on wich I have to write the website URL. I believe it would be possible to add some code like {{site_url}} that uses the actual site URL.
add_action('check_admin_referer', 'logout_without_confirm', 10, 2);
function logout_without_confirm($action, $result)
{
/**
* Allow logout without confirmation
*/
if ($action == "log-out" && !isset($_GET['_wpnonce'])) {
$redirect_to = isset($_REQUEST['redirect_to']) ? $_REQUEST['redirect_to'] : 'https://mydomain.com/?loggedout=true';
$location = str_replace('&', '&', wp_logout_url($redirect_to));
header("Location: $location");
die;
}
}
This would allow me to use this snipet on multiple sites, without having to change the Site URL every time. The idea would be tu have nstead of “https://mydomain.com/?loggedout=true” for something like “{{site_URL}}/?loggedout=true” instead.
Would that be possible? Or some other PHP code? Thank you very much in advance!