PHP $_GET vars lost in shortcode
-
Hi, just wanted to say great plugin! However I’ve run into a bit of an issue with a shortcode I created that relies on $_GET to get a date querystring param from the url to load dynamic data from the DB. I noticed that you mentioned in another thread that this plugin doesn’t/can’t support Code Snippets (which is where I located the code). Easy enough for me to put it in my child theme functions.php though. Here’s a simplified version of what I’m doing…
if( isset($_GET['date'] ) && $_GET['date'] ){ $now = strtotime($_GET['date']); }else{ $now = time(); } //print_r( $_GET ); //This now gives: Array ( [action] => eos_dyn_get_content ) //Simplified *unsafe* sql for brevity $sql = "SELECT * FROM mqq_participants_database WHERE UNIX_TIMESTAMP(
show_from
) <= $now AND UNIX_TIMESTAMP(show_to
) >= $now ORDER BYshow_from
DESC LIMIT 1";As I’m currently testing, it’s not urgent and I will be removing the user-supplied ($_GET) date, relying solely on the current time, but possible I’ll be making an interactive section in another page.
Wondering if there’s a workaround or if it’s just my rotten luck to have chosen Code Snippets?
- The topic ‘PHP $_GET vars lost in shortcode’ is closed to new replies.