• Skip to main content
  • Skip to primary sidebar
  • About
  • Contact
  • Resources
  • Blog
    • Easy Digital Downloads
    • General
    • Genesis Framework
    • jQuery/JavaScript
    • Project Management
    • WordPress Functions
    • WordPress Plugin Development
  • Army Lessons

Scott DeLuzio

WordPress Development Tutorials

Show Easy Digital Downloads Licensed URLs

February 6, 2017 Scott DeLuzio Leave a Comment

I have been selling WordPress plugins with Easy Digital Downloads for a few years now. I’m very grateful for the Software Licensing extension for Easy Digital Downloads because it enables me to track sales through the use of the built-in licensing function. Every time one of my plugins licenses is activated on a customer’s site, Software Licensing gets notified of the site URL, which is awesome. This can potentially let me see how my customers are using the plugins I’ve created. Unfortunately, there isn’t a “master report” that shows me all of the sites my plugins have been activated on.

Instead, if I wanted to view all of the sites, I would have to click through to the details page for each license. If I have hundreds of licenses this could be a very time-consuming process.

Show Easy Digital Downloads Licensed URLs

I decided to create a little function that queries the database to show Easy Digital Downloads licensed URLs for all of the sites that have activated one of my plugins. This way I can have one master report that shows a list of the sites my customers have been using my plugins on.

function get_sites(){
	$licenses = get_posts( array(
		'posts_per_page'	=> -1,
		'post_type'		=> 'edd_license',
		'meta_query' 		=> array(
			array(
				'key' 	=> '_edd_sl_sites',
			)
		)
	) );
	wp_reset_postdata();
	$post_ids = array();
	if ( $licenses ){
		foreach( $licenses as $license ){
			$post_ids[] = $license->ID;
		}
	}
	if ( $post_ids ){
		echo '<ul>';
		foreach ( $post_ids as $post_id ){
			$sites = get_post_meta( $post_id, '_edd_sl_sites', true );
			$download_id = get_post_meta( $post_id, '_edd_sl_download_id', true);
			$download = get_the_title( $download_id );
			if ( $sites ){
				foreach( $sites as $site ){
					echo '<li><a href="http://' . $site . '">http://' . $site . '</a> - ' . $download . '</li>';
				}
			}
		}
		echo '</ul>';
	}
}

function get_sites(){ $licenses = get_posts( array( 'posts_per_page' => -1, 'post_type' => 'edd_license', 'meta_query' => array( array( 'key' => '_edd_sl_sites', ) ) ) ); wp_reset_postdata(); $post_ids = array(); if ( $licenses ){ foreach( $licenses as $license ){ $post_ids[] = $license->ID; } } if ( $post_ids ){ echo '<ul>'; foreach ( $post_ids as $post_id ){ $sites = get_post_meta( $post_id, '_edd_sl_sites', true ); $download_id = get_post_meta( $post_id, '_edd_sl_download_id', true); $download = get_the_title( $download_id ); if ( $sites ){ foreach( $sites as $site ){ echo '<li><a href="http://' . $site . '">http://' . $site . '</a> - ' . $download . '</li>'; } } } echo '</ul>'; } }

This function can be used anywhere to display all of the sites that your customers are using your plugins. If you want it for your own internal purposes, you can create a page on the admin side that displays this information. You can even display this on the front end of the site to show off a list of sites that are using your plugin. While the example isn’t formatted in a very pretty format, it could be modified in order to build a showcase section on your site.

There might be a better way of doing this, but this is functional. And for my purposes, it did what I needed it to do. If you have any thoughts on how to improve this or how you might be able to use this information, let me know in the comments.

WordPress Plugin Development, Easy Digital Downloads

Reader Interactions

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Primary Sidebar

Come say hi!

  • Facebook
  • GitHub
  • Instagram
  • LinkedIn
  • Twitter
  • YouTube

Tweets by scottdeluzio

My Products

Conditional Checkout FieldsFull Screen Background ImagesQuick CheckoutWP1099

I use affiliate links throughout this site and may earn a commission if you purchase through my links. I do not link to products or services that I do not trust, or use myself.
© 2025 · Scott DeLuzio · Built on the Genesis Framework