Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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.

share|improve this question
add comment

1 Answer

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

share|improve this answer
    
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
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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