Gravity Wiz

Magically enhanced tutorials, snippets and plugins for Gravity Forms!

  • Gravity Perks
    • Gravity Perks
    • Tutorials & Snippets
    • About
  • Support
    • Documentation
    • Support
    • Account

Close Comments when Post Created via Gravity Forms

Last updated December 11, 2014 | Written by David Smith 2 Comments

This simple snippet allows you to close comments on posts created via a Gravity Form.

Download Code
/**
* Close Comments when Post Created via Gravity Forms
* https://gravitywiz.com/2012/04/25/close-comments-when-post-created-via-gravity-forms/
*/
// update the '6' to the ID of your form
add_filter('gform_post_data_6', 'gform_close_comments');
function gform_close_comments($post_data){
$post_data['comment_status'] = 'closed';
return $post_data;
}
view raw gistfile1.php hosted with ❤ by GitHub

Did this resource help you do something awesome with Gravity Forms? Then you'll absolutely love Gravity Perks; a suite of 29+ essential add-ons for Gravity Forms with support you can count on.

  • View All Perks
  • Buy Gravity Perks

Filed Under: Snippets

Comments

  1. Allan Schmidt says

    September 28, 2012 at 4:37 pm

    This would only close comments from one GF created post/form, yes?

    Reply
    • David Smith says

      September 28, 2012 at 7:16 pm

      This would close comments on each created by the form ID your specify in the filter name or all forms if you remove the form ID completely from the filter name.

      It would only impact posts created after the snippet is implemented.

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Categories

  • How To (29)
  • News (20)
  • Plugins (5)
  • Releases (5)
  • Resource (1)
  • Snippets (61)
  • Tip (1)
  • Tutorials (43)
  • Updates (62)

Recent Posts

  • Gravity Wiz Weekly #62
  • Gravity Forms Populate Anything, Public Beta Available!
  • Gravity Wiz Weekly #61
  • Gravity Wiz Weekly #60
  • Gravity Wiz Weekly #59

Meta

  • Log in
  • Entries RSS
  • Comments RSS
  • WordPress.org

Copyright © 2019 · Powered by WordPress · Gravity Wiz LLC · Log out

  • Support
  • Affiliates
  • About
  • Sitemap
  • Gravity Perks
    ▼
    • Gravity Perks
    • Tutorials & Snippets
    • About
  • Support
    ▼
    • Documentation
    • Support
    • Account