Or, embed this snippet using GenerateWP WordPress Plugin.

Download

Clone

the survey

// WP_Query arguments
$args = array(
	'p'                      => '$surveyId',
	'post_type'              => array( 'surveys' ),
	'post_status'            => array( 'publish' ),
	'posts_per_page'         => '1',
);

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

// The Loop
if ( $query_survey->have_posts() ) {
	while ( $query_survey->have_posts() ) {
		$query_survey->the_post();
		// do something
	}
} else {
	// no posts found
}

// Restore original Post Data
wp_reset_postdata();