Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save robertuniqid/b99a59354a3d82a22cb0f95e21b7953d to your computer and use it in GitHub Desktop.
Save robertuniqid/b99a59354a3d82a22cb0f95e21b7953d to your computer and use it in GitHub Desktop.
<?php
add_action( "init", function() {
if( get_option( "_temp_did_run_123456", false ) !== false )
return;
$product_id = 1;
$post_types = array_keys( wpep_content_type()->contentTypes );
foreach( $post_types as $post_type ) {
$post_list = wpep_get_post_list_assoc( $post_type );
foreach( $post_list as $post_id => $post_title ) {
update_post_meta( $post_id, 'wpep_woocommerce_required_product_ids', $product_id );
}
}
update_option( "_temp_did_run_123456", time() );
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment