Last active
December 21, 2015 02:19
-
-
Save jdevalk/6234102 to your computer and use it in GitHub Desktop.
Make EDD work with NGINX
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 | |
/** | |
* Make sure EDD doesn't trip over the NGINX values of global server settings and returns the proper current page URL. | |
* | |
* @param string $url The current page URL | |
* @return string The fixed current page URL. | |
*/ | |
function yst_fix_edd_current_page_url( $url ) { | |
if ( is_front_page() ) : | |
$page_url = home_url(); | |
else : | |
$page_url = 'http'; | |
if ( ( isset( $_SERVER["HTTPS"] ) && $_SERVER["HTTPS"] == "on" ) || intval( $_SERVER["SERVER_PORT"] ) == 443 ) | |
$page_url .= "s"; | |
$page_url .= "://" . $_SERVER["SERVER_NAME"] . $_SERVER["REQUEST_URI"]; | |
endif; | |
return $page_url; | |
} | |
add_filter( 'edd_get_current_page_url', 'yst_fix_edd_current_page_url', 10, 1 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment