xxxxxxxxxx
<?php echo get_site_url(); ?>
Results:
http://www.example.com
xxxxxxxxxx
$current_url = home_url($_SERVER['REQUEST_URI']);
Returns current url
xxxxxxxxxx
thanks to "Akmal" on "https://wordpress.stackexchange.com/questions/274569/how-to-get-url-of-current-page-displayed"
xxxxxxxxxx
global $wp;
$current_url = home_url(add_query_arg(array($_GET), $wp->request));