Reply To: Creating Posts from Forms

Home Forums Quform WordPress Creating Posts from Forms Reply To: Creating Posts from Forms

#29442
therondp
Participant

Thanks for sharing I followed the guide step by step and got a failed plugin upload message – This code (below message) I used in a folder called quform-custom-code which I zipped and then uploaded to my WordPress plugin upload. The post type coupons I entered in the code is one of my custom post types.

I am wondering if one of your developers could whip up the basic plugin for this with the option to add Post Title, Post Content, Featured Image, categories and custom fields? That would really help me and I’m sure it’s second nature to your developers to do quickly.

/*
* Plugin Name: Quform Custom Code
* Description: Custom code for Quform.
* Version: 1.0
*/

// Paste in your custom code below

add_filter(‘quform_post_process_7’, function (array $result, Quform_Form $form) {
$title = $form->getValue(‘quform_7_1’);
$content = $form->getValue(‘quform_7_15’);

$post = array(
‘post_title’ => $title,
‘post_content’ => $content,
‘post_type’ => ‘Coupons’,
‘post_status’ => ‘draft’
);

wp_insert_post($post);

return $result;
}, 10, 2);

Be inspired. © 2024 ThemeCatcher Ltd. 20-22 Wenlock Road, London, England, N1 7GU | Company No. 08120384 | Built with React | Privacy Policy