How to insert post meta values in wordpress -
How to insert meta values when adding posts? I am using the wp_insert_post function to insert the post. In order to use the "Add_post_meta" function, we need to specify the post ID. How can I add value when posting? Is there any way to do this?
Value - DJ
I think you created an array for posting $ Post, 'post_type' = & gt; $ content, 'post_type' = & gt; $ type, 'post_states' =' & Gt; $ position); Get it with
newly inserted post_ id
$ id = wp_insert_post ($ new_post);
Then pass the parameters like post_ id, meta_key, meta_view
update_post_meta ($ id, 'total_payments', $ amount) and the value in the wp_postmeta table Insert; Update_post_meta ($ id, 'downcount', $ downcount);
Try it out.
Comments
Post a Comment