Printing a variable inside a custom WP_Query August 14, 2022 by Tarik Billa Remove the single quotation, use flowing code. hope it will work 'post_type' => $post_type_name,