Developer Knowledge Level

This content is intended for WordPress developers, and it may require coding knowledge of WordPress, PHP, and JavaScript. Code examples provided here may contain errors or needs some additional coding. Make sure to test the code before using it on a live website!

By default, the search will be done through all the available forums. Using the filter ‘gdpos_diallowed_forums_ids_list‘ you can control list of forums that will be excluded.

This filter provides 1 argument only.

Arguments

  • $list: empty array as a placeholder

Important

There are a few things you need to know:

  • This filter is fired when the form is generated to populated forum selection and when the search query is created.
  • If you have forum hierarchy, you need to list exact ids for forums and subforums you want to exclude.
  • You can use conditional functions inside the filter function – for instance, to get a user ID and build a list of forums for individual users.
  • This filter will not be used if you use a gdpos_allowed_forums_ids_list filter.

Example

This example will not allow a search through forums with ID’s listed in line 3.

add_filter('gdpos_disallowed_forums_ids_list', 'custom__gdpos_forums_ids_list');
function custom__gdpos_forums_ids_list($list) {
    return array(58041, 7137, 7138, 7169, 23087, 50267);
}
0
0
528
Rate this reference

You are not allowed to rate this post.

Comments

Leave a Reply