Skip to content

Instantly share code, notes, and snippets.

@mayankverma-mwb
Created December 2, 2022 05:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mayankverma-mwb/fe1bccc41b02da8122f211a73aaa9315 to your computer and use it in GitHub Desktop.
Save mayankverma-mwb/fe1bccc41b02da8122f211a73aaa9315 to your computer and use it in GitHub Desktop.
function
$args = array(
'numberposts' => -1,
'post_type' => 'wps_subscriptions',
'post_status' => 'wc-wps_renewal',
'meta_query' => array(
'relation' => 'AND',
array(
'key' => 'wps_subscription_status',
'value' => 'active',
),
array(
'relation' => 'AND',
array(
'key' => 'wps_parent_order',
'compare' => 'EXISTS',
),
array(
'key' => 'wps_customer_id',
'value' => get_current_user_id(),
'compare' => '==',
),
),
),
);
$wps_subscriptions = get_posts( $args );
foreach ( $wps_subscriptions as $key => $value ) {
$subscription_id = $value->ID;
// do something here
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment