wp_guess_url

Definition:
function wp_guess_url() {}

Guess the URL for the site.
Will remove wp-admin links to retrieve only return URLs not in the wp-admin directory.

Source code

function wp_guess_url() {

	if ( defined('WP_SITEURL') && '' != WP_SITEURL ) {

		$url = WP_SITEURL;

	} else {

		$schema = is_ssl() ? 'https://' : 'http://';

		$url = preg_replace('|/wp-admin/.*|i', '', $schema . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']);

	}

	return rtrim($url, '/');

}

3753

No comments yet... Be the first to leave a reply!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: