Or, embed this snippet using GenerateWP WordPress Plugin.

Download

Clone

Basic Query

// WP_Query arguments
$args = array(
	'post_type'              => array( 'test', ' test 2' ),
	's'                      => 'test',
	'nopaging'               => false,
	'paged'                  => '1',
	'posts_per_page'         => '100',
	'posts_per_archive_page' => '100',
	'order'                  => 'ASC',
	'orderby'                => 'rand',
	'tax_query'              => array(
		'relation' => 'OR',
		array(
			'taxonomy'         => 'category',
			'terms'            => '1',
			'field'            => 'term_id',
			'include_children' => true,
		),
		array(
			'taxonomy'         => 'category',
			'terms'            => '2',
			'field'            => 'term_id',
			'include_children' => true,
		),
	),
	'date_query'             => array(
		array(
			'before'        => '3/9/2017',
			'after'         => '1/1/2017',
			'inclusive'     => true,
		),
	),
	'meta_query'             => array(
		array(
			'key'     => 'test',
			'value'   => 'testval',
			'compare' => '=',
		),
	),
);

// The Query
$query = new WP_Query( $args );