$_GET not working in shortcode
-
I have this shortcode that runs another gallery shortcode. I am trying to filter the posts that are being displayed.
This dosen’t work (note the
post_taxonomy_term="' . $_GET['cat'] .'"]'
):function want_filter_lookbook_shortcode_callback($atts, $content, $name){ // Build output $output = do_shortcode( '[cactus-masonry masonry="true" quality="large" link_location="full" display_post_titles="true" width="33.33%" show_lightbox="true" show_lightbox_title="true" browse_with_lightbox="false" custom_post_types="portfolio-item" post_taxonomy="portfolio-category" post_taxonomy_term="' . $_GET['cat'] .'"]' ); return $output; }
But this does:
function want_filter_lookbook_shortcode_callback($atts, $content, $name){ // Build output $output = do_shortcode( '[cactus-masonry masonry="true" quality="large" link_location="full" display_post_titles="true" width="33.33%" show_lightbox="true" show_lightbox_title="true" browse_with_lightbox="false" custom_post_types="portfolio-item" post_taxonomy="portfolio-category" post_taxonomy_term="bottoms"]' ); return $output; }
So when I hard code the value instead of using
$_GET
it works.
This is the exact url:https://dev.want.ca/?page_id=16?cat="bottoms"
Any ideas why?
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘$_GET not working in shortcode’ is closed to new replies.