I want to show a form at the end of my purchase-confirmation page only in the case where the previous page / HTTP_REFERER is the checkout page. I've tried lots of different ideas.

For example, I was hoping the PHP Snippets would solve my problem. But it doesn't appear to work at all with the newest version of Wordpress.

Anyway, I need something like this:

Thank you for your purchase! [edd_receipt]

    [insert_php]if( strpos($_SERVER[HTTP_REFERER], "checkout" ) == true ):[/insert_php] 
        [wpforms id="123"]
    [insert_php] endif; [/insert_php] 

Ideas?

closed as off-topic by Tom J Nowell Sep 13 at 1:24

This question appears to be off-topic. The users who voted to close gave this specific reason:

If this question can be reworded to fit the rules in the help center, please edit the question.

  • Note that shortcodes that let you put PHP code inside posts or content boxes are incredibly dangerous, and a massive security problem. You also loose access to all the WP APIs and any request data. You should uninstall the plugin for that ASAP. Also note that the referrer can be spoofed and isn't secure. Have you contacted EDD support? This question requires EDD specific knowledge, WP general expertise will have limited value here, you should go to the EDD communities and their developer support and docs – Tom J Nowell Sep 13 at 1:24
  • How is asking about shortcodes not specific to WP? I was just about to give a answer, thanks a lot. I really hate this trigger happy mods on SO sites. – redanimalwar Sep 13 at 1:26
  • Abuse of power obviously. This because his personal opinion is that he should not use that plugin for security reasons he just declares a WP specific question as not WP specific. – redanimalwar Sep 13 at 1:49
  • @RradRhoads You can write use the echo do_shortcode('[any_shortcode]'); in actual php code to conditionally call it. And if you want to get rid of that plugin you could write you own shortcode that calls another shortcode on condition. – redanimalwar Sep 13 at 1:49
  • @RradRhoads You missed the quotes on $_SERVER['HTTP_REFERER'] and your string check is flawed. Should be if ( false !== strpos( $_SERVER['HTTP_REFERER'], 'checkout' ) ) { – redanimalwar Sep 13 at 1:51