I am creating a plugin that gets an array from external source and I want to add this to a custom post type which is already created.
I am just using something simple like the below right now
add_post_meta( $post->ID, product_price, $import_price ); add_post_meta( $post->ID, product_discount_price, $import_discount ); add_post_meta( $post->ID, product_excerpt, $import_excerpt ); add_post_meta( $post->ID, product_sku, $import_sku ); add_post_meta( $post->ID, product_url, $import_url );
My issue is I am creating a new entry so I don't know the post_id. Is there a way to default it so it generates the next one available?
I've also tried
$post_id. But if I replace it with a number manually instead of a variable it works great.
Any assistance is appreciated.