[wp-hackers] Custom post types filtering

Olivier autremonde75 at gmail.com
Tue Jun 29 16:38:53 UTC 2010

So actually, it is feasible. I found the trick.

You need to hook there :

And then use this filtering function :
function my_posts_where($where)
	global $wpdb, $current_user, $wp_version;

	if ($wp_version >= '3.0' && is_admin() && $_GET['post_type'] ==
	       $where = str_replace($wpdb->posts.".post_type = 'my_post_type'
AND",$wpdb->posts.".post_type = 'my_post_type' AND ".$wpdb-
>posts.".post_author = ".$current_user->ID." AND", $where);


And you are done!

Now I am wondering how to remove or update the custom post type
numbers at the top as they aren't relevant anymore with this kind of

More information about the wp-hackers mailing list