Support » Plugins » Retrieving $_POST Variables in wordpress page

  • I am trying to create a wordpress plugin for a payment gateway. The gateway sends a data back on given URL (in my case : On this URL I have a set wordpress to email as soon as it detects posted variables as well as update database result of that particular payment.

    Can someone please tell me how I can retrieve all POST variables sent from external URL in wordpress.

    This is what I am doing at the moment.

    add_shortcode('payment_success_wp', array($this, 'payment_success')); //second argument is array because function is in a class file.
    function payment_success() {
        global $wpdb;
        $this->table_name = $wpdb->prefix . "my_payments";
        mail('', "about payments", "just chasing up" . print_r($_POST));
        if (isset($_POST['transactionstatus']) && isset($_POST['total'])) {
            $data = array(
                'payment_status' => $_POST['transactionstatus'],
            $wpdb->update($this->table_name, $data, array('payment_id' => $_POST['oid']));

    I have added above shortcode on new page with the URL The function (shortcode) implementation is as below. .

    When I call above page manually then the email does get trigger. Which I think is really strange but when the gateway sends parameters to payment-success page then nothing happens.

  • The topic ‘Retrieving $_POST Variables in wordpress page’ is closed to new replies.