Jump to content

Is there a way to exclude knowledge base articles from the search?


JamiePipeTen

Recommended Posts

this will hide articles from displaying knowledgebase search but not in suggestions.

 

create new PHP file in /includes/hooks/ directory and put the following code in it :)

 

<?php


add_hook("ClientAreaPage", 1, function($vars){

   if ($vars['filename']!="knowledgebase" || $_REQUEST['action']!="search"){
       return;
   }

   # Article IDs to exclude, separate by comma
   $articlesToExclude = array(1,4);

   foreach ($vars['kbarticles'] as $index => $article){
       if (in_array($article['id'], $articlesToExclude)){
           unset($vars['kbarticles'][$index]);
       }
   }

   return array("kbarticles" => $vars['kbarticles']);
});

Link to comment
Share on other sites

  • 5 months later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated