Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save wpfullstripe/08c30129127efbfa0e243224efabafa3 to your computer and use it in GitHub Desktop.
Save wpfullstripe/08c30129127efbfa0e243224efabafa3 to your computer and use it in GitHub Desktop.
The fullstripe_members_supported_post_types Wordpress filter
<?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