Skip to content

Instantly share code, notes, and snippets.

@gnuget
Created October 5, 2009 09:12
Show Gist options
  • Save gnuget/201994 to your computer and use it in GitHub Desktop.
Save gnuget/201994 to your computer and use it in GitHub Desktop.
Hide the posts created using a write panel
function exclude_writepanels_posts($where){
global $wpdb, $parent_file;
if( $parent_file != 'edit.php' ) return $where;
if (empty($_GET['filter-posts'])){
$where = $where . " AND 0 = (SELECT count($wpdb->postmeta.meta_value)
FROM $wpdb->postmeta WHERE $wpdb->postmeta.post_id = $wpdb->posts.ID and $wpdb->postmeta.meta_key = '_mf_write_panel_id')";
}
return $where;
}
add_filter('posts_where', 'exclude_writepanels_posts');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment