One aspect of my site is creating an XML listing for an external application (which would be logged into the site via the login mechanism). This would be a list of ids that the application can then build a menu for showing what is available. An example URL the app requests would be:
http://site.com/getListing?catids=13,15,16
The problem is that I don't see a way to determine if a particular post or category is restricted. I've included my php code below, with <<<<----- signifying where I want to do a check.
Any suggestions...and sorry if this is plainly covered somewhere.
- Code: Select all
foreach( $catids as $catID ) {
if (MEMBER CANNNOT ACCESS CATEGORY) continue; <<<<---- check and skip
$args = array( 'posts_per_page' => $numposts, 'cat' => $catID, 'post_type' => array( 'post', 'gallery','ad') );
$my_query = new WP_Query($args);
while ($my_query->have_posts()) : $my_query->the_post();
if (MEMBER CANNNOT ACCESS POST) continue; <<<<---- check and skip
echo $post->ID;
endwhile;
}
If I can pass something on to query_args, I can do this as well -- using something like this:
- Code: Select all
$args = array( 'posts_per_page' => $numposts, 'cat' => $catID);
$my_query = new WP_Query($args);