How do I pass custom shortcode-extracted variables (taxonomy) into a query function for WordPress RoyalSlider?
Two words – variable scope. Use a closure instead and pass $rstax through with use: add_filter( ‘new_royalslider_posts_slider_query_args’, function ( $args ) use ( $rstax ) { return array( ‘post_type’ => ‘carousel-slide’, ‘orderby’ => array( ‘menu_order’ => ‘ASC’ ), ‘tax_query’ => array( array( ‘taxonomy’ => ‘carousel-slide-category’, ‘field’ => ‘slug’, ‘terms’ => $rstax, ), ), ) } … Read more