Browse: Home / Hooks /

learndash_focus_mode_comments

apply_filters( 'learndash_focus_mode_comments',  string $comment_status,  WP_Post|array|null $post )

Filters the status of comments in the focus mode.


Description #


Parameters #

$comment_status

(string) Status of comments.

$post

(WP_Post|array|null) Post Object.


Source #

File: includes/ld-misc-functions.php


Examples #

Note: Extended code example below not guaranteed, you may need to consult with a developer

 <?php
/**
 * Example usage for learndash_focus_mode_comments filter.
 */
add_filter(
	'learndash_focus_mode_comments',
	function( $comment_status = 'closed', $post ) {
		// Example Only allow comments on Quiz post type.
		if ( $post->post_type === 'sfwd-quiz' ) {
			$comment_status = 'open';
		}
		return $comment_status;
	},
	20,
	2
);