array( 'product_variation', 'product' ), 'post_status' => 'publish', 'posts_per_page' => -1, 'fields' => 'ids', ); $query = new WP_Query( $post_args ); foreach ( $query->posts as $product ) { delete_post_meta( $product, 'bitly_link' ); delete_post_meta( $product, 'joturl_link' ); delete_post_meta( $product, 'yourls_link' ); delete_post_meta( $product, 'tinyurl_link' ); } delete_option( 'url_options' ); delete_option( 'yourls_domain' ); delete_option( 'joturl_public' ); delete_option( 'tinyurl_domain' ); delete_option( 'joturl_private' ); delete_option( 'yourls_signature' ); delete_option( 'bitly_access_token_options' ); delete_option( 'tinyurl_access_token_options' );