Search code examples
phpwordpresshtmlshortcode

$_GET Wordpress Get URL Variables Infusionsoft


So I am trying to get the email variable out of the URL of which works if I do it in the page template however then whenever you wish to change the form you have to open the files and change it instead of just posting it in the page editor.

The below code is what I have setup as a shortcode in my functions.php

function get_email() {
    return $_GET["inf_field_Email"];
}
add_shortcode('email', 'get_email');

The code echo $_GET["inf_field_Email"]; works if I include it inside the php template so I know that isn't the issue.

However when I try to use the shortcode in the Wordpress page editor all it displays in the form field is the shortcode I entered [email] and does not return the Variable from the URL.

Here is the form field:

And FYI the URL provided works fine with the echo $_GET["inf_field_Email"]; so I can also say its not the URL that's the issue.

EDIT: Clarifying how the form is inserted into the page

The form is inserted into the page editor so its being pulled in through the content loop correct. When i insert the code manually outside the loop and echo the $_GET it works fine but I need it to work inside the_content() loop.

EDIT: Suggested that I dump the var and return the variable, still doesn't work

function get_email() {
    $emailinput = $_GET["inf_field_Email"];
    var_dump($emailinput);

    return $emailinput;
}
add_shortcode('email', 'get_email');

Solution

  • I ended up using the form code inside the php page template instead of the wordpress CMS page. I believe this is an issue with Infusion Soft and wordpress working together in order to display shortcodes as values inside the embed infusionsoft forms.