Backfill existing reviews with “verified” comment meta on update to 2.5.
This commit is contained in:
parent
95fe3d47c2
commit
a34d58c18f
|
@ -25,7 +25,8 @@ class WC_Install {
|
|||
'2.2.0' => 'updates/woocommerce-update-2.2.php',
|
||||
'2.3.0' => 'updates/woocommerce-update-2.3.php',
|
||||
'2.4.0' => 'updates/woocommerce-update-2.4.php',
|
||||
'2.4.1' => 'updates/woocommerce-update-2.4.1.php'
|
||||
'2.4.1' => 'updates/woocommerce-update-2.4.1.php',
|
||||
'2.5.0' => 'updates/woocommerce-update-2.5.php',
|
||||
);
|
||||
|
||||
/**
|
||||
|
|
|
@ -0,0 +1,30 @@
|
|||
<?php
|
||||
/**
|
||||
* Update WC to 2.5.0
|
||||
*
|
||||
* @author WooThemes
|
||||
* @category Admin
|
||||
* @package WooCommerce/Admin/Updates
|
||||
* @version 2.5.0
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* "Verified owner" labeling is now powered by comment meta - backfill this for existing reviews.
|
||||
*/
|
||||
$unverified_comments = new WP_Comment_Query( array(
|
||||
'meta_query' => array(
|
||||
array(
|
||||
'key' => 'verified',
|
||||
'compare' => 'NOT EXISTS'
|
||||
)
|
||||
),
|
||||
'post_type' => 'product',
|
||||
'type__not_in' => array( 'order_note' ),
|
||||
'fields' => 'ids',
|
||||
) );
|
||||
|
||||
array_map( array( 'WC_Comments', 'add_comment_purchase_verification' ), $unverified_comments->comments );
|
Loading…
Reference in New Issue