Trying to create a shortcode to display categories with a specific product tag
You need to pass your attributes in the shortcode as key-value pairs, and use them in php as an array as follows: [tagtagtag tag_id=246] function get_categories_with_product_in_tag( $atts ) { global $wpdb; return $wpdb->get_results( $wpdb->prepare( “SELECT categories.* FROM “. “{$wpdb->prefix}terms categories “. “INNER JOIN {$wpdb->prefix}term_taxonomy ctax ON (categories.term_id = ctax.term_id) “. “INNER JOIN {$wpdb->prefix}term_relationships crel ON … Read more