2

I'm not sure if this is feasible, but I would like to create a payment form and associate it with a WordPress post. In short, users can create posts that will only be published after payment. So what I need is:

  • Associate a post ID with the contribution form, considering that the same form would be used for different posts and users.
  • Trigger a hook when the payment is approved.

1 Answer 1

2

Once the user has submitted a post (default status unpublished) redirect the user to the Contribution page with postId in the URL. On the contribution page you can include a custom field (called post id) for the contribution and make it hidden via CSS or JS by default and populate the field from the URL.

This will be stored against the Contribution that is created.

Once the Contribution status is set to Completed you can write post() hook and publish the content using the post id stored in contribution custom field.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.