I have a post and payment page each posts contain a payment form

I want to know how I can retrieve the data to I can execute and publish where the post payment came from

on payment form submit

 $return = array('success' => true, 'msg' => 'Payment Successful',
            'current_post_id' => get_the_ID(),'payment_made' => true);

then payment page

function enable_post($current_post_id) {

if (payment_made =='true') {

/* Execute a Jquery that would affect the post */
/* Make post Publish instead of draft*/
} }

2 Answers 2


I think this can ve achieved using hidden fields if the single post form

Add a field like this in your form



<input type="hidden" name="mypostid" value="<?php get_the_id(); ?>" />

And the page where this form is posting the data you can get the data for the field mypostid

I hope this should solve the problem


I couldn't understand your question. If you are adding payment form to a post which is not public, then how any one can see the payment form. If you want to say that you already have some posts which are not published yet, then pass the id of the post that you want to publish via the payment form and after the payment completed chance the status of the post with that id from draft to publish...

  • my question is not about payment form, its about how to retrieve the post id where the payment form is located to be executed on the other page e.g. if form is located in post_id=1 then on execute page, it will display like thank your for purchasing post_id=1 your post will now be publish
    – JPL
    Jul 21, 2015 at 12:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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