0
votes

$insert = $wpdb->insert( $prefix."posts", array("post_title" => $posTitle,"post_content" => $postContent,"post_status" => "publish","post_type" =>"product"));

I insert image path in wordpress posts table and post parent contain ID of product ID also add _thumbnail_id in postmeta table product id my main focus is to display image in post product page in wp-admin

2

2 Answers

0
votes

Image will be inserted in the postmeta table with the id of related post. If you are using the default post of WordPress you can get image by using the function get_the_post_thumbnail( $post_id, $size, $attr ); or you can fetch these from postmeta.

0
votes

You can use the function get_the_post_thumbnail( $post_id, $size, $attr ); for the custom post type too.
See the link http://codex.wordpress.org/Function_Reference/get_the_post_thumbnail