Created
May 7, 2020 12:17
-
-
Save serkanalgur/d19328a8f1a68af99c46ca0c43eabf6f to your computer and use it in GitHub Desktop.
Revisions
-
serkanalgur created this gist
May 7, 2020 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,20 @@ <?php /** * Yazı İsmi : 30 Günden Eski Mesajlarınıza Yorum Yapılmasını Engellemek * Yazı Linki : https://wpadami.com/cms-sistemleri/wordpress/30-gunden-eski-mesajlariniza-yorum-yapilmasini-engellemek.html */ function close_comments($posts) { if (!is_single()) { return $posts; } if (time() - strtotime($posts[0]->post_date_gmt) > (30 * 24 * 60 * 60)) { $posts[0]->comment_status = 'closed'; $posts[0]->ping_status = 'closed'; } return $posts; } add_filter('the_posts', 'close_comments');