Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save duogeekdev/313450071bad10f8340e to your computer and use it in GitHub Desktop.
Save duogeekdev/313450071bad10f8340e to your computer and use it in GitHub Desktop.
How to enable shortcode in BBPress reply
<?php
add_filter('bbp_get_reply_content', 'bb_sc_render', 99, 2);
add_filter('bbp_get_topic_content', 'bb_sc_render', 99, 2);
function bb_sc_render( $content, $reply_id ) {
$reply_author = bbp_get_reply_author_id( $reply_id );
if( current_user_can( 'manage_options' ) )
// You can use custom capability, like:
// current_user_can( 'custom_cap' )
return do_shortcode( $content );
return $content;
}
add_filter('bbp_get_reply_content', 'bb_sc_render', 99, 2);
add_filter('bbp_get_topic_content', 'bb_sc_render', 99, 2);
function bb_sc_render( $content, $reply_id ) {
$reply_author = bbp_get_reply_author_id( $reply_id );
if( user_can( $reply_author, 'publish_forums' ) )
return do_shortcode( $content );
return $content;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment