Title: Configuring your short code for BBpress
Last modified: September 1, 2016

---

# Configuring your short code for BBpress

 *  Resolved [khunmax](https://wordpress.org/support/users/khunmax/)
 * (@khunmax)
 * [9 years, 10 months ago](https://wordpress.org/support/topic/configuring-your-short-code-for-bbpress/)
 * Hey
 * Thanks for a great plugin.
 * I have a site with both a blog and a forum powered by BBpress.
 * I use your plugin for searches in the blog with your shortcode in a widget in
   the sidebar and the settings option “posts” ticked in your plugin UI.
 * I have my own functionality plugin installed. I am running the following script
   so that the wordpress search engine can search BBpress content:
 *     ```
       /**
        * Include bbPress 'topic' custom post type in WordPress' search results */
   
       function ntwb_bbp_topic_cpt_search( $topic_search ) {
       	$topic_search['exclude_from_search'] = false;
       	return $topic_search;
       }
       add_filter( 'bbp_register_topic_post_type', 'ntwb_bbp_topic_cpt_search' );
   
       /**
        * Include bbPress 'forum' custom post type in WordPress' search results */
   
       function ntwb_bbp_forum_cpt_search( $forum_search ) {
       	$forum_search['exclude_from_search'] = false;
       	return $forum_search;
       }
       add_filter( 'bbp_register_forum_post_type', 'ntwb_bbp_forum_cpt_search' );
   
       /**
        * Include bbPress 'reply' custom post type in WordPress' search results  */
   
       function ntwb_bbp_reply_cpt_search( $reply_search ) {
       	$reply_search['exclude_from_search'] = false;
       	return $reply_search;
       }
       add_filter( 'bbp_register_reply_post_type', 'ntwb_bbp_reply_cpt_search' );
       ```
   
 * PLEASE NOTE that When running the above code, if I tick “ALL’ in the setting 
   in your plugin UI then your search will include BBPress forum, topic and reply
   content.
 * THIS IS WHAT I WANT TO DO:
 * 1. Have your shortcode in the sidebars for just the blog and wp posts. AND just
   search posts. I currently achieve this using the basic shortcode and your plugin
   set to “posts”.
 * 2. HOWEVER, i also want to put your shortcode in the sidebar for all Forum pages
   and JUST search for Forums, Topics and replies. I note your plugin has the shortcode
   option [wpns_search_form
    only_search=”my_custom_post_type”] but I don’t know
   how to configure so just BBpress Forums, Topics and Replies are searched. For
   example, I have tried:
 *  [wpns_search_form only_search=”bbp_register_topic_post_type”]
 * and
 * [wpns_search_form only_search=”ntwb_bbp_topic_cpt_search”]
 * But neither of these work and the test searches come up empty.
 * So I would be very grateful if you could tell me how to configure your shortcode
   so that it will search the forum, topic and reply custom post types created by
   my code displayed above.
 * Please also note that there is currently a small bug at the bottom of your plugin
   UI. The shortcode there is broken into two lines and it also has a hover function
   on it link an active link but nothing happens if you click on it. It is also 
   difficult to read the short as it is broken over two lines. Is it correct form
   as follows?
 * [wpns_search_form only_search=””]
 * Thanks in advance for any assistance.
 * Kind Regards
 * Max
 * [https://wordpress.org/plugins/wp-nice-search/](https://wordpress.org/plugins/wp-nice-search/)

Viewing 4 replies - 1 through 4 (of 4 total)

 *  Plugin Contributor [duynguyen](https://wordpress.org/support/users/duynguyen/)
 * (@duynguyen)
 * [9 years, 10 months ago](https://wordpress.org/support/topic/configuring-your-short-code-for-bbpress/#post-7533886)
 * Hi khunmax,
 * Thank for using my plugin.
 * Regarding to your questions, currently plugin only can search on basic table 
   of wordpress database such as post. If BBPress forum using another table or database
   so it will not work. “All” option means it will search on post, page and custom
   post type. It doesn’t mean you can search on BBPress. The shortcode `[wpns_search_form
   only_search="bbp_register_topic_post_type"]` means your search only searches 
   in custom post type names `bbp_register_topic_post_type`. This post type should
   be defined before.
 * Thanks,
    Duy
 *  Thread Starter [khunmax](https://wordpress.org/support/users/khunmax/)
 * (@khunmax)
 * [9 years, 10 months ago](https://wordpress.org/support/topic/configuring-your-short-code-for-bbpress/#post-7533890)
 * Hey Duy
 * Thanks for your fast reply.
 * I don’t think you understand my question. I will try to explain it again.
 * The code I posted above adds bbpress content to the wordpress db.
 * I have already tested it with your plugin and it works!!
 * If run the code above in my own functionality plugin…And tick the option “all”
   in your plugin UI…Then Nice Search will search and return bbpress forums, topics
   and replies (as well as all wp content).
 * HOWEVER, I want to use your shortcode in the sidebar of my forums. And I want
   to limit its search to just bbpress content (I want to filter out all WP content).
 * **So what do I add to your shortcode to (filter out) not show WP content?**
 * Kind Regards
 * Max
 *  Plugin Contributor [duynguyen](https://wordpress.org/support/users/duynguyen/)
 * (@duynguyen)
 * [9 years, 10 months ago](https://wordpress.org/support/topic/configuring-your-short-code-for-bbpress/#post-7533976)
 * Hi Max,
 * Sorry for responding lately. What exactly names of custom post type which you
   registered for topic, forum and reply? I suppose you create a custom post type
   name `topic` so to search only on this custom post type, you just make a shortcode
   look like this `[wpns_search_form only_search="topic"]`.
 * The same way as `[wpns_search_form only_search="forum"]` for custom post type
   names `forum` and `[wpns_search_form only_search="reply"]` for custom post type
   names `reply`.
 * However, you can’t search on both of theme (topic, forum, reply) by shortcode
   above. It only searches on one custom post type.
 * Thanks,
    Duy
 *  Thread Starter [khunmax](https://wordpress.org/support/users/khunmax/)
 * (@khunmax)
 * [9 years, 10 months ago](https://wordpress.org/support/topic/configuring-your-short-code-for-bbpress/#post-7533994)
 * hey DuY
 * Thanks for your reply. I will test the shortcode using “reply” because that should
   then pick up all of the content in the forums anyway?
 * I will let you know how it goes.
 * Kind Regards
 * Max

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Configuring your short code for BBpress’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/wp-nice-search_3280a3.svg)
 * [WP Nice Search](https://wordpress.org/plugins/wp-nice-search/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wp-nice-search/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wp-nice-search/)
 * [Active Topics](https://wordpress.org/support/plugin/wp-nice-search/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wp-nice-search/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wp-nice-search/reviews/)

 * 4 replies
 * 2 participants
 * Last reply from: [khunmax](https://wordpress.org/support/users/khunmax/)
 * Last activity: [9 years, 10 months ago](https://wordpress.org/support/topic/configuring-your-short-code-for-bbpress/#post-7533994)
 * Status: resolved