get_results('SELECT * FROM '.$table_prefix.'postmeta WHERE meta_key LIKE "%athena%"', ARRAY_A); $profiles = get_option(ATHENA_PROFILE, false); $posts = get_option(ATHENA_POST, false); if(!empty($profiles) && is_array($profiles)){ foreach($profiles as $p){ wp_clear_scheduled_hook( 'athena_profile_ex_'.$p['id'], array($p['id']) ); if(isset($p['email']) && $p['email'] === true){ wp_clear_scheduled_hook( 'athena_profile_email_'.$p['id'], array($p['id'])); } } } if(!empty($posts) && is_array($posts)){ foreach($posts as $p){ wp_clear_scheduled_hook( 'athena_post_ex_'.$p, array($p) ); } } if(is_array($meta)){ foreach($meta as $value){ delete_post_meta($value['post_id'], $value['meta_key']); } }//end check if variable is array $args = array( 'post_type' => 'athenaprofile', 'posts_per_page' => -1 ); $profiles = get_posts( $args ); foreach($profiles as $key){ delete_option('athena_profile_' . $key->ID); wp_delete_post( $key->ID ); } delete_option(ATHENA_OPT); delete_option(ATHENA_POST); delete_option(ATHENA_PROFILE); } register_uninstall_hook(__FILE__, 'athena_deactivate' );