Skip to content

Instantly share code, notes, and snippets.

@jdevalk
Created August 14, 2013 09:36
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jdevalk/6229430 to your computer and use it in GitHub Desktop.
Save jdevalk/6229430 to your computer and use it in GitHub Desktop.
Make sure the AJAX URL for EDD uses the protocol for the current page, either http or https, as it doesn't work otherwise.
<?php
/**
* Make sure the AJAX URL for EDD uses the protocol for the current page, either http or https, as it doesn't work otherwise.
*
* @param string $ajaxurl The current ajaxurl
*
* @return string
*/
function yst_filter_edd_ajax_url( $ajaxurl ) {
if ( is_ssl() ) {
return $ajaxurl;
} else {
return str_replace( 'https://', 'http://', $ajaxurl );
}
}
add_filter( 'edd_ajax_url', 'yst_filter_edd_ajax_url' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment