Title: use wordpress internal search engine programmically
Last modified: August 21, 2016

---

# use wordpress internal search engine programmically

 *  Resolved [AliMH](https://wordpress.org/support/users/alimh/)
 * (@alimh)
 * [11 years, 12 months ago](https://wordpress.org/support/topic/use-wordpress-internal-search-engine-programmically/)
 * hi,
    i wanna use wordpress internal search engine if relevenssi return no result,
   but i couldn’t figure it out. can you please shed some light on it? and where
   i can resolve this? my main problem is relevanssi cannot find some search terms
   like ‘k-on’ but wordpress search engine can, so i wanna use it when relevanssi
   return nothing.
 * [https://wordpress.org/plugins/relevanssi/](https://wordpress.org/plugins/relevanssi/)

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

 *  Plugin Author [Mikko Saari](https://wordpress.org/support/users/msaari/)
 * (@msaari)
 * [11 years, 12 months ago](https://wordpress.org/support/topic/use-wordpress-internal-search-engine-programmically/#post-5007922)
 * Why not make Relevanssi find those search terms instead? Just add this code to
   your theme functions.php and reindex the database:
 *     ```
       add_filter('relevanssi_remove_punctuation', 'rlv_fix_the_problem', 9);
       function rlv_fix_the_problem($a) {
           $a = str_replace('-', '', $a);
           return $a;
       }
       ```
   
 *  Thread Starter [AliMH](https://wordpress.org/support/users/alimh/)
 * (@alimh)
 * [11 years, 12 months ago](https://wordpress.org/support/topic/use-wordpress-internal-search-engine-programmically/#post-5007981)
 * oh thanks, it solved my problem
 *  Thread Starter [AliMH](https://wordpress.org/support/users/alimh/)
 * (@alimh)
 * [11 years, 12 months ago](https://wordpress.org/support/topic/use-wordpress-internal-search-engine-programmically/#post-5007984)
 * oh, i face a new problem related to this;
    now, no result for ‘Aki Sora’ and 
   i should search for ‘Aki-Sora’.
 *  Plugin Author [Mikko Saari](https://wordpress.org/support/users/msaari/)
 * (@msaari)
 * [11 years, 12 months ago](https://wordpress.org/support/topic/use-wordpress-internal-search-engine-programmically/#post-5008015)
 * Well, you can’t have everything… but you can try this:
 *     ```
       add_filter('relevanssi_remove_punctuation', 'rlv_fix_the_problem', 9);
       function rlv_fix_the_problem($a) {
           if (strlen($a) <= 5) {
               $a = str_replace('-', '', $a);
           }
           else {
               $a = str_replace('-', ' ', $a);
           }
           return $a;
       }
       ```
   
 * Now if the word is less than six characters long, hyphens are removed, otherwise
   they are replaced with spaces. So, “k-on” becomes “kon”, while “aki-sora” becomes“
   aki sora”. That might work better.
 *  Thread Starter [AliMH](https://wordpress.org/support/users/alimh/)
 * (@alimh)
 * [11 years, 12 months ago](https://wordpress.org/support/topic/use-wordpress-internal-search-engine-programmically/#post-5008047)
 * lol, good idea, really thanks mate.

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

The topic ‘use wordpress internal search engine programmically’ is closed to new
replies.

 * ![](https://ps.w.org/relevanssi/assets/icon-256x256.png?rev=3529670)
 * [Relevanssi - A Better Search](https://wordpress.org/plugins/relevanssi/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/relevanssi/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/relevanssi/)
 * [Active Topics](https://wordpress.org/support/plugin/relevanssi/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/relevanssi/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/relevanssi/reviews/)

 * 5 replies
 * 2 participants
 * Last reply from: [AliMH](https://wordpress.org/support/users/alimh/)
 * Last activity: [11 years, 12 months ago](https://wordpress.org/support/topic/use-wordpress-internal-search-engine-programmically/#post-5008047)
 * Status: resolved