0

I'm currently using a custom post type with a custom meta box for two image uploads.

I'm trying to create a front-end post page where the user can upload their own images from their desktop. All of the online examples worked - however they didn't submit to my custom meta box fields.

1

When I was working on the same the issue was that when you try to add custom meta box before the post is created it did not work. So what I did was once the post was created added the following code

$imagepath = wp_get_attachment_image_src( $upload[1], $size );
update_post_meta($post_id, 'image_path', $imagepath[0];

So what happen's here is that $upload[1] is the image attachment id and using the wp_get_attachment_image_src i will get the source of the image url which you can attach to a custom post. Or you can use another function but this is pretty much. I am assuming you want a image path there are lot's of other function's you can use

  • I'm not very good with WordPress yet. I appreciate your reply, but I'm not sure I understand it. – Stephen Mar 21 '12 at 22:51
  • Hi Stephen Can you show the code on what you are working it will be really helpful to explain.. – tjrocks Mar 29 '12 at 7:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.