Skip to content

Instantly share code, notes, and snippets.

@JiveDig
Created July 16, 2014 14:54
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 JiveDig/6bda48397bb71789b9e2 to your computer and use it in GitHub Desktop.
Save JiveDig/6bda48397bb71789b9e2 to your computer and use it in GitHub Desktop.
Preset a download to variable pricing on post creation/save
/**
* Preset a download to variable pricing on post creation/save
*
* @since 1.0
*/
add_action( 'save_post', 'beats_preset_variable_pricing', 20, 2 );
function beats_preset_variable_pricing( $post_id ) {
// If this isn't a 'download' post, don't update it.
if( 'download' !== get_post_type() ) {
return;
}
// Set variable pricing to true
update_post_meta( $post_id, '_variable_pricing', true );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment