Find posts with no user connection
-
Loving your plugin Scribu.
I need to create a drop down of posts that have not been connected with any users. How do I add that to my get_posts() arguments?
Noddy (expensive) example:
function get_unconnected_suppliers(){ $available = array(); $suppliers = get_posts( array( 'post_type' => 'supplier', 'post_status' => 'publish', 'numberposts' => -1, 'posts_per_page' => -1, 'orderby' => 'title', 'order' => 'ASC', ) ); foreach( $suppliers as $supplier ) : $users = get_users( array( 'connected_type' => 'user_supplier', 'connected_items' => $supplier ) ); if( $users ): continue; endif; $available[] = $supplier; endforeach; return $available; }
Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
The topic ‘Find posts with no user connection’ is closed to new replies.