Created
November 3, 2021 06:31
-
-
Save ericnicolaas/777d65aa41332ea2fb7df8b011e39a57 to your computer and use it in GitHub Desktop.
Create a new campaign programatically
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
add_action( | |
'admin_init', | |
function() { | |
return charitable_create_campaign( | |
array( | |
'title' => 'My new campaign', | |
'content' => 'Extended content about this campaign', | |
'creator' => get_current_user_id(), | |
'status' => 'draft', | |
'parent' => 541, | |
'description' => 'Programatically created campaign', | |
'goal' => 5000, | |
'end_date' => date( 'Y-m-d', strtotime( '+1 year' ) ), | |
'suggested_donations' => array( | |
array( 'amount' => 25, 'description' => 'Bronze' ), | |
array( 'amount' => 75, 'description' => 'Silver' ), | |
array( 'amount' => 150, 'description' => 'Gold' ), | |
), | |
'allow_custom_donations' => 1, | |
) | |
); | |
} | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment