标签:ext cal arc echo action oba 关键词 redirect on()
add_action(‘admin_init‘, ‘php_search_ban_key‘); function php_search_ban_key() { add_settings_field(‘php_search_key‘, ‘搜索关键词屏蔽‘, ‘php_search_key_callback_function‘, ‘reading‘); register_setting(‘reading‘,‘php_search_key‘); } function php_search_key_callback_function() { echo ‘<textarea name="php_search_key" rows="10" cols="50" id="php_search_key" class="large-text code">‘ . get_option(‘php_search_key‘) . ‘</textarea>‘; } add_action(‘template_redirect‘, ‘php_search_ban‘); function php_search_ban(){ if (is_search()) { global $wp_query; $php_search_key = get_option(‘php_search_key‘); if($php_search_key){ $php_search_key = str_replace("\r\n", "|", $php_search_key); $BanKey = explode(‘|‘, $php_search_key); $S_Key = $wp_query->query_vars; foreach($BanKey as $Key){ if( stristr($S_Key[‘s‘],$Key) != false ){ wp_die(‘请不要搜索非法关键字‘); } } } } }
标签:ext cal arc echo action oba 关键词 redirect on()
原文地址:https://www.cnblogs.com/kinblog/p/12515190.html