[wp-hackers] uninstall post meta with get_post issue

Ken Ken at adcSTUDIO.com
Mon Aug 30 19:45:21 UTC 2010

Hi All,

I've been trying to write an uninstall for my plugin, but the following 
doesn't work:

if( !defined( 'ABSPATH') && !defined('WP_UNINSTALL_PLUGIN') )
$get_posts_args = array('numberposts' => -1, // codex code had 0
			  'post_type' => 'any',
			  'post_status' => null );
$all_posts = get_posts( $get_posts_args );
foreach( $all_posts as $postinfo) {
	delete_post_meta($postinfo->ID, 'post_meta_one');
	delete_post_meta($postinfo->ID, 'post_meta_two');

I put this in uninstall.php in the root folder of my plugin. For some 
reason it won't delete anything the meta of drafts. Am I doing something 

More information about the wp-hackers mailing list