Hello, I am trying to query custom post types created by Toolset and managed with the Toolset Access plugin. However my query will only return results if the post type is set to guest readable, which is not what I want. I have verified that the post type is queryable and that exclude_from_search is unchecked.
$found = false;
$query = new WP_Query(array(
'post_type' => '{slug}',
'post_status' => 'publish',
'meta_key' => 'wpcf-{slug}',
'meta_value' => '{value}'
));
if ( $query->have_posts() ) {
$found = true;
}
When I enable guest access in the Access table the query returns the expected instances, but if I uncheck the guest read access then no instances are returned. Can you tell me how to get the WP_Query working with non public content? I've also confirmed that the page is being accessed by the proper user with wp_get_current_user(). One thing to note is that this role was not created in Toolset but by another plugin.
Thanks!
Adrian
Hi Adrian,
Would you please test by adding a new user role using Toolset Access and make sure that it has the "read" capability for the custom post type in question?
See if that method works for you.
Thanks.