Created
July 1, 2019 11:22
-
-
Save raazon/e19b929852536a0b637d448bde8601d5 to your computer and use it in GitHub Desktop.
Get current url including query string in wordpress
This file contains hidden or 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
/** | |
* Get current page url with query string | |
* @since 1.0.0 | |
* @return: full url of your current page with query string | |
* @use: echo get_current_page_url(); | |
*/ | |
if ( ! function_exists( 'get_current_page_url_with_query_string' ) ) { | |
function get_current_page_url_with_query_string() { | |
global $wp; | |
return add_query_arg( $_SERVER['QUERY_STRING'], '', home_url( $wp->request ) ); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment