Register Post Type Filters
-
Seeing the filters in bbpress.php:
// Post type identifiers
$this->forum_post_type = apply_filters( 'bbp_forum_post_type', 'forum' );
$this->topic_post_type = apply_filters( 'bbp_topic_post_type', 'topic' );
$this->reply_post_type = apply_filters( 'bbp_reply_post_type', 'reply' );I thought this could be easily modified; however, I am struggling to get my filters to work from functions.php. I’ve tried the following solutions:
add_filter( 'bbp_forum_post_type' , function($post_type) { return 'wps_' . $post_type; } );
add_filter( 'bbp_topic_post_type' , function($post_type) { return 'wps_' . $post_type; } );
add_filter( 'bbp_reply_post_type' , function($post_type) { return 'wps_' . $post_type; } );And,
add_filter( 'bbp_forum_post_type' , 'wps_my_custom_post_type' , 1, 1 );
add_filter( 'bbp_topic_post_type' , 'wps_my_custom_post_type' , 1, 1 );
add_filter( 'bbp_reply_post_type' , 'wps_my_custom_post_type' , 1, 1 );
function wps_my_custom_post_type( $post_type ) {
//just add prefix
$prefix = 'wps_';
return $prefix . $post_type;
}Neither seem to work, and I am not sure what I am missing.
- You must be logged in to reply to this topic.