WordPress.org

Ready to get started?Download WordPress

Forums

How to create URL in plugin? (1 post)

  1. jaypabs
    Member
    Posted 1 year ago #

    I am new to wordpress plugin and I have started a few lines of code. What I am wondering now is on how to create a URL that will listen for incoming data using GET method.

    I would like to have a URL like:

    http://www.mydomain.com/process.php

    This process.php file contains a php code that saves a value from the parameter.

    Example I have a javascript on the same website that call this URL like:

    http://www.mydomain.com/process.php?value=1&country=US

    Inside process.php is a simple script that will save the value to the table like:

    <?php
    $value = $_GET["value"];
    $country = $_GET["country"];
    
    $wpdb->insert( 'wp_mytable', array( 'value' => $value, 'country' => $country ), array( '%s', '%s' ) );
    ?>

Topic Closed

This topic has been closed to new replies.

About this Topic