Currently I am trying to create a custom front page CMS for adding products for customers. However I am trying to place the product into a category. I have the following codes:
$post = array( 'ID' => $product_id , 'menu_order' => null , 'comment_status' => 'closed' , 'ping_status' => 'closed' , 'pinged' => null, 'post_author' => $user->ID, 'post_category' => array(15), 'post_content' => "test1" , 'post_date' => date('Y-m-d H:i:s') , 'post_date_gmt' => date('Y-m-d H:i:s') , 'post_excerpt' => null , 'post_name' => "test1" , 'post_parent' => null, 'post_password' => null , 'post_status' => 'publish' , 'post_title' => "test1" , 'post_type' => 'product' , 'tags_input' => null, 'to_ping' => null, 'tax_input' => null ); wp_insert_post( $post, $wp_error );
The category ID is 15. I even tried this:
Also has anyone been able to have quick codes for setting variable attributes to product based on the page ID?
- The topic ‘Creating Products from Front End’ is closed to new replies.