Skip to content

Instantly share code, notes, and snippets.

@williamsba
Created February 6, 2014 19:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save williamsba/8851321 to your computer and use it in GitHub Desktop.
Save williamsba/8851321 to your computer and use it in GitHub Desktop.
Return only the latest product version on the front-end in Easy Digital Downloads
add_filter( 'edd_download_files', 'appp_show_latest_product_version' );
function appp_show_latest_product_version( $files ) {
//only show the latest version of a product everywhere except the admin dashboard
if ( is_array( $files ) && ! is_admin() ) {
//count the file array size
$arr_count = count( $files );
//store only the last array value, which is the latest product version
$files = array_slice( $files, $arr_count - 1 );
}
return $files;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment