Hi,
If the image is uploaded, you can follow this documentation to know how to set the field value by coding
https://docs.metabox.io/functions/rwmb-set-meta/
Hi, Thanks for the response
Actually my question is how we can upload image by code?
If i am uploading an image like below code I am getting a placeholder image as in the following link.
View post on imgur.com
I know that’s not the right way but can you please refer a doc on how I can upload an image by code??
add_post_meta( $post_id , ‘advert_gallery’ , $imageFile);
Hi,
Uploading images by code is beyond the scope of support of Meta Box. You might need to create a new topic in WP support forum to ask for help with this case.
https://wordpress.org/support/forum/how-to-and-troubleshooting/
Ok. Is ther a way to fill the meta box text fields programatically with wp_insert_post()?
I am using this code to for filling text fields
add_post_meta( $post_id , ‘advert_negotiable’ , 1);
Fields are filled but are requried to refresh the page manually.
Is this a right way to do that? or any suggestions?
add_post_meta( $post_id , ‘advert_negotiable’ , 1);
Hi,
You can use the argument meta_input
to insert the meta key and value along with the post. Please read more on the documentation https://developer.wordpress.org/reference/functions/wp_insert_post/
and refer to this topic https://wordpress.stackexchange.com/questions/218131/wp-insert-post-add-meta-input