Created
May 8, 2018 09:32
-
-
Save mrkkr/ba79be2e9b31e3f05b3297676bb80b00 to your computer and use it in GitHub Desktop.
Wordpress - get current url by PHP #php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/// without prefix | |
$current_url = "//" . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; | |
/// with prefix | |
global $wp; | |
$current_url = home_url( add_query_arg( array(), $wp->request ) ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment