Fill empty custom field with other custom field
Assuming your products are custom posts you can do it like this: add_action(‘wp_insert_post’, ‘do_stuff’); // when product is created add_action(‘save_post’, ‘do_stuff’ ); // on product update function do_stuff( $post_id ) { // Making sure this runs only for products $slug = ‘product_post’; if ( $slug != $_POST[‘post_type’] ) { return; } if (!get_post_meta( $post_id, ‘new_price’, … Read more