Skip to content

Instantly share code, notes, and snippets.

@cklosowski
Created January 25, 2018 19:55
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 cklosowski/64a261bb348c52b17864a65425264ebc to your computer and use it in GitHub Desktop.
Save cklosowski/64a261bb348c52b17864a65425264ebc to your computer and use it in GitHub Desktop.
Add TLDs and Subdomains to Software Licensing is_local_url checks.
<?php
// Example of adding a TLD (.org in this example) to the is_local_url check.
function ck_add_url_tlds( $tlds_to_check ) {
$tlds_to_check[] = '.org';
return $tlds_to_check;
}
add_filter( 'edd_sl_url_tlds', 'ck_add_url_tlds', 10, 1 );
// Example of adding a subdomain (*.stage in this example) to the is_local_url check.
function ck_add_url_subdomains( $subdomains_to_check ) {
$subdomains_to_check[] = '*.stage';
return $subdomains_to_check;
}
add_filter( 'edd_sl_url_subdomains', 'ck_add_url_subdomains', 10, 1 );
@shazahm1
Copy link

To add WP Engine, would I use:

$subdomains_to_check[] = '*.wpengine.com';

GoDaddy has a more "random" staging site, ie. z#.#f#.myftpupload.com So would this work on the edd_sl_url_subdomains filter?

$subdomains_to_check[] = '*.myftpupload.com';

@Spreeuw
Copy link

Spreeuw commented Oct 11, 2018

adding them to the tld check seems better, as it uses a more general catch all:

if ( false !== strpos( $host, $tld ) )

I use this:

add_filter( 'edd_sl_url_tlds', 'edd_sl_local_tlds' );
function edd_sl_local_tlds( $tlds ) {
	$tlds[] = '.wpengine.com';
	$tlds[] = '.myftpupload.com';
	return $tlds;
}

@planetahuevo
Copy link

Is this something that the site owner needs to do or the hosting company? or the developer of the plugin?
I am using my custom staging urls and I am not able to make this work so far.
Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment