Created
July 16, 2014 14:54
-
-
Save JiveDig/6bda48397bb71789b9e2 to your computer and use it in GitHub Desktop.
Preset a download to variable pricing on post creation/save
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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