How to set the WPUF Form as the default form
Author | Posts |
---|---|
May 11, 2013 at 12:41 pm 3503 | |
Hi I have two issues please 1. How can I set all the posts to have the same form by default as am only using one form. instead of me having to go to the back end changing each post on its own. 2. when a members edits their post and updates it, the commenting section gets closed on that post. How can I fix this thanks | |
May 11, 2013 at 3:15 pm 3513 | |
1. There isn’t any bulk update system right now. But you can update all your posts form association using this code below. Put that code on your theme functions.php, reload the page once and remove the code. $form_id = 143; $all_posts = new WP_Query( array('posts_per_page' => -1) ); if ( $all_posts->have_posts() ) { $posts = $all_posts->get_posts(); foreach ($posts as $p) { update_post_meta( $p->ID, '_wpuf_form_id', $form_id ); } } 2. Make sure you are using the latest version (2.1.4). | |
May 12, 2013 at 8:15 am 3522 | |
Hi Tareq so if there is a way to make it the default form then that would be great thanks | |
May 12, 2013 at 11:39 am 3525 | |
So you can listen to posts when they inserts and set the form id like this: if ( $post->post_type == ‘post’ ) { add_action( ‘wp_insert_post’, ‘wpufe_auto_set_formid’, 10, 2 ); Every new posts will have this form id automatically. | |
May 16, 2013 at 4:58 am 3693 | |
Just chiming in on this to say it works great to batch update. Thanks! | |
June 8, 2013 at 8:13 pm 4677 | |
Hi | |
August 15, 2013 at 10:40 am 6979 | |
I have the same query. I posted a different thread. But I can’t find it now. The code you gave it’s not working for me. So can you take a look to my site? | |
August 16, 2013 at 7:35 pm 7022 | |
How did you tried? It should’ve worked! |