Created
September 1, 2022 13:13
-
-
Save wpfullstripe/08c30129127efbfa0e243224efabafa3 to your computer and use it in GitHub Desktop.
The fullstripe_members_supported_post_types Wordpress filter
This file contains 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 characters
<?php | |
/** | |
* A 'fullstripe_members_supported_post_types' filter hook example for WP Full Stripe Members. | |
* It implements a filter hook that adds the 'post' post type to the supported custom post types. | |
* | |
* @param array postTypes The custom post types provided by the plugin or a previous filter of the filter chain. | |
* @param array params array $params An array containing additional parameters. Not used currently. | |
* | |
* @return array Filtered custom post types array | |
*/ | |
function addCustomPostTypes( $postTypes, $params ) { | |
$result = $postTypes; | |
if ( false === array_search('post', $postTypes) ) { | |
array_push( $result, 'post' ); | |
} | |
return $result; | |
} | |
add_filter('fullstripe_members_supported_post_types', 'addCustomPostTypes', 10, 2 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment