Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Easy Digital Downloads - hide purchase buttons on download grid and single download page if download is assigned to a specific category
function sumobi_edd_hide_purchase_button_for_categories( $purchase_form, $args ) {
// add the category name, slug or ID into this array
$categories = array( 'category one', 12, 'some-category' );
if ( has_term( $categories, 'download_category', $args['download_id'] ) ) {
return $purchase_form;
add_filter( 'edd_purchase_download_form', 'sumobi_edd_hide_purchase_button_for_categories', 10, 2 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment