Set featured Image from frontend after post
-
Hi!
I updated wordpress to version 3.5 and one of my functions not working anymore.
I have a page with post form from frontend where users can submit posts to one category.After the upgrade to 3.5 i can create post fine and upload image too in the media lubrary but , the function that i use to attach the uploaded image like featured image to the post not working for some reason that i can’t fnd why.
i use this code to set featured image after the post is sucessful created and the image is uploaded to the media library.I can capture the $post_id and the $attach_id
wpuf_set_post_thumbnail( $post_id, $attach_id );I made change to the code too but without luck
add_post_meta( $post_id, '_thumbnail_id', $attach_id,true );i I manualy ad post_meta to the post in the database the image is apearing as featured fine but i must set the “_edit_lock” first.
when i ad this code the _edit_lock is inserted in the post_meta but not the “_thumbnail_id”add_post_meta( $post_id, '_thumbnail_id', $attach_id,true ); add_post_meta( $post_id, '_edit_lock', time().':1',true); in wordpress 3.5 is any restrictions about "_thumbnail_id" post_meta execution from fronted ?Any help to acomplish this please?
Thanks!
-
the
wpuf_set_post_thumbnail()was typo the corect function that I use is the built in wordpress core functionset_post_thumbnail( $post_id, $attach_id );i found temporary solutionis to set post to draft
What do you do if the user has uploaded multiple images?
Is there a way to have the Set Featured Image link on the list of options within the media uploader turned on?you can try this plugin to see how that work
http://wordpress.org/extend/plugins/wp-user-frontend/Once it’s updated for WP 3.5 that would be a very good reference yes. It still lists compatability as 3.4.2 and last update prior to 3.5 release or betas.
the plugin work fine on wordpress 3.5 if you set the post to draft in admin settings
Thanks lunaticalm – Unfortunately working in 3.5 and using the new media uploader of 3.5 are two very different things and I’m trying to figure out a solution for the latter case.
The topic ‘Set featured Image from frontend after post’ is closed to new replies.