apply_filters( 'learndash_post_type_feed', boolean $cpt_has_feed, string $feed_post_type, WP_Post_Type $feed_post_type_object )
Filters whether to show feeds for the custom post type.
Description #
Parameters #
- $cpt_has_feed
-
(boolean) Whether to show feeds for the post type. True to show feed otherwise false.
- $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_type_feed filter. */ add_filter( 'learndash_post_type_feed', function( $has_archive, $feed_post_type, $feed_post_type_object ) { // Example 1: Allow Courses and Lessons Feeds. if ( in_array( $feed_post_type, array( 'sfwd-courses', 'sfwd-quiz' ) ) ) { $has_archive = true; } else { $has_archive = false; } // Always return $has_archive. return $has_archive; }, 10, 3 );
Changelog #
Version | Description |
---|---|
2.6.0 | Introduced. |