How to get value of Shortcode when its appended to URL and Stored in Database

44 views Asked by At

I stored the url in Database https://example.in/register/?ref=[affiliate_id] and I tried to get the affiliate id of current logged in user.But I am unable to get the value when I print it. But if I used as directly like using $val = do_shortcode('[[affiliate_id]'); I am getting the value. Please solve my issue

1

There are 1 answers

0
Akshay Shah On

I am not sure but use below code it might be resolved your problem

 add_action('init','runShortcode');

 function runShortcode(){
  $getCode = $_request['ref'];
  If($getCode)
  {
     $shirtcodes = '['.$getCode.']';

     echo do_shortcode($shirtcides);
  }

Not sure with code