WP query by custom post type slug/name

I am running a simple wp query to retrieve just one post.

But the post is a custom post-type post, not a normal post

Read More
$ajaxBike = $_GET['varbike']; 

$bikeProfile = new WP_Query(array(

    'name'          => $ajaxBike,
    'meta_query'    => array(
        array(
            'key' => 'app_visibility',
            'value' => 1,
            'compare' => '='
        )
    )

));

or…

$ajaxBike = $_GET['varbike']; 

$bikeProfile = new WP_Query('name='.$ajaxBike);

But I think the name parameter only works for posts. But I’m struggling to find anything to work with a custom post type slug.

Can you anyone help work out how to query a custom post type using the slug?

Thanks in advance!

Related posts

Leave a Reply

1 comment