Product Bundles
Complete
Security
Explore the benefits of Jetpack
Learn how Jetpack can help you protect, speed up, and grow your WordPress site. Get up to 50% off your first year.
function jpcarousel_auto_close_comments( $open, $post_id ) { $post = get_post( $post_id ); $days_old = (int) get_option( 'close_comments_days_old' ); if ( ! $days_old ) return $open; if( $post->post_type == 'attachment' && time() - strtotime( $post->post_date_gmt ) > ( $days_old * DAY_IN_SECONDS ) ) { return false; } return $open; } add_filter( 'comments_open', 'jpcarousel_auto_close_comments', 10 , 2 );
Jetpack Mechanic 🚀 at Automattic. WordPress, board games, TV Series, music.
Have a question?
Comments are closed for this article, but we're still here to help! Visit the support forum and we'll be happy to answer any questions.
Enter your email address to follow this blog and receive news and updates from Jetpack!
Email Address:
Subscribe
Automatically close comments in the Carousel view
Explore the benefits of Jetpack
Learn how Jetpack can help you protect, speed up, and grow your WordPress site. Get up to 50% off your first year.
Explore plansYou can use the following code to automatically close comments in the Carousel view, based on the number of days you’ve defined in Settings > Discussion:
This entry was posted in Code snippets, Tips & Tricks and tagged Carousel, Comments. Bookmark the permalink.
Jeremy Herve
- Tumblr
- Mastodon
- Facebook
- Twitter
- WhatsApp
- More
- LinkedIn
- Email
- Print
- Pinterest
- Reddit
- Pocket
Like Loading...
Jetpack Mechanic 🚀 at Automattic. WordPress, board games, TV Series, music.
Explore the benefits of Jetpack
Learn how Jetpack can help you protect, speed up, and grow your WordPress site. Get up to 50% off your first year.
Explore plansShare this
Like this:
Related