Skip to content

creating new donation (option-based) form by code #7868

Answered by alaca
chenganma asked this question in Developer Q&A
Discussion options

You must be logged in to vote

Hi @chenganma. Yes, with the latest Give release, every form should be associated with a campaign. In other words, form cannot exist outside the campaign context. There are a couple of approaches you could take here. The first one is to create a campaign using the campaign model. Also, the donation form will be automatically created and associated with a campaign. Example

public function createCampaign(WP_REST_Request $request): WP_REST_Response

The second one is to use the REST API and send a request to this endpoint

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by alaca
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants