webwhalenl
Forum Replies Created
-
Forum: Plugins
In reply to: [Post My CF7 Form] Publish posts instantlyHi @aurovrata,
Nope, I didn’t get it working. So I gave up; we will post reviews manually on our website now.
Forum: Plugins
In reply to: [Post My CF7 Form] Publish posts instantlyDear Aurovrata,
Thanks for your reply. So now I’ve added the below code (I replaced post_type) with my own post_type, and I’ve configured this post type in the Post my CF7 form settings.
add_action(‘cf7_2_post_form_mapped_to_webwhale’,’modify_form_posts’,10,2); function modify_form_posts($post_id, $cf7_form_data){ //cf7_form_data is the submitted data from your form //post_id is the id of the post to which it has been saved. $args = array( 'ID' => $post_id, 'post_status' => 'publish' ); wp_update_post($args); } ?>But still, when I post something in the form, the post is still a draft, and not immediately published. Is there something else which I’m doing wrong?
Your help is really appreciated.
Forum: Plugins
In reply to: [Post My CF7 Form] Can’t edit Post Type after creating itAllright, will do. Thanks a lot for the explanation, clarifies a lot.
Forum: Plugins
In reply to: [Post My CF7 Form] get Posts to publishDear Aurovrata,
Many thanks for your quick reply. I have put that exact piece of code on the bottom of my theme’s functions.php file, however the new posts still appear as drafts.
Any idea what goes wrong here?
Best regards,
Max de Feber
Forum: Plugins
In reply to: [Post My CF7 Form] get Posts to publishDear Aurovrata,
I’m not very experienced with hooks in WordPress. I also would like to have the new posts published immediately, without first being posted as drafts. If I understand it correctly, from the above messages, the following code needs to be added:
/** * Custom code for instant publishing */ add_action(‘cf7_2_post_form_mapped_to_my-cpt’,’modify_form_posts’,10,2); function modify_form_posts($post_id, $cf7_form_data){ //cf7_form_data is the submitted data from your form //post_id is the id of the post to which it has been saved. $args = array( 'ID' => $post_id, 'post_status' => 'publish' ); wp_update_post($args); }[Moderator note: code fixed. Please wrap code in the backtick character or use the code button.]
Where do I have to add this code, though?
Many thanks for helping out!
Best regards,
Max de Feber
Forum: Plugins
In reply to: [Post My CF7 Form] Can’t edit Post Type after creating itAlso, I cannnot update the custom post settings, I get this error message:
“Something is wrong, try to reload the page”
Reloading the page, however, doesn’t help.