Support » Plugin: Relevanssi - A Better Search » search slug with Chines characters

Viewing 1 replies (of 1 total)
  • Plugin Author Mikko Saari

    (@msaari)

    That’s just spam. It’s not related to Relevanssi, you’d get that without Relevanssi.

    It’s relatively harmless. It’s also so common that I happen to have a bit of code that will block those searches:

    add_filter( 'pre_get_posts', 'rlv_block_search' );
    function rlv_block_search( $query ) {
        if (!empty($query->query_vars['s'])) {
            $blacklist = array( '大奖', 'q82' ); // you can add blacklist entries here; no need for whole words, use the smallest part you can
            foreach( $blacklist as $term ) {
                if( mb_stripos( $query->query_vars['s'], $term ) !== false ) exit();
            }
         }
    }

    However, it would be even better if those spam searches could be blocked at server level before they even fire up WordPress in the first place.

Viewing 1 replies (of 1 total)
  • The topic ‘search slug with Chines characters’ is closed to new replies.