apply_filters( 'learndash_post_comments', boolean $cpt_has_comments, string $feed_post_type, WP_Post_Type $feed_post_type_object )
Filters whether to show comments for a CPT or not.
Description #
Parameters #
- $cpt_has_comments
-
(boolean) Whether to show comments for the CPT or not.
- $feed_post_type
-
(string) Post Type slug.
- $feed_post_type_object
-
(WP_Post_Type) WP_Post_Type instance.
Source #
Examples #
Note: Extended code example below not guaranteed, you may need to consult with a developer
<?php /** * Example usage for learndash_post_comments filter. */ add_filter( 'learndash_post_comments', function( $cpt_has_comments, $feed_post_type, $feed_post_type_object ) { // May add any custom logic using $cpt_has_comments, $feed_post_type, $feed_post_type_object. // Always return $cpt_has_comments. return $cpt_has_comments; }, 10, 3 );
Changelog #
Version | Description |
---|---|
2.6.0 | Introduced. |