{"id":220083,"date":"2023-02-01T15:32:00","date_gmt":"2023-02-01T12:32:00","guid":{"rendered":"https:\/\/wordpress.mediadoma.com\/?p=220083"},"modified":"2023-02-01T15:32:03","modified_gmt":"2023-02-01T12:32:03","slug":"kak-nastroit-poiskovuju-sistemu-dlja-wordpress","status":"publish","type":"post","link":"https:\/\/wordpress.mediadoma.com\/ru\/kak-nastroit-poiskovuju-sistemu-dlja-wordpress\/","title":{"rendered":"\u041a\u0430\u043a \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u043f\u043e\u0438\u0441\u043a\u043e\u0432\u0443\u044e \u0441\u0438\u0441\u0442\u0435\u043c\u0443 \u0434\u043b\u044f WordPress?"},"content":{"rendered":"<p><a href=\"https:\/\/wordpress.mediadoma.com\/ru\/upravlenie-soedinenijami-wordpress-nastrojkami-v-odnom-meste-dlja-neskolkih-sajtov-wordpress-v-odnom-domene\/\" title=\"WordPress\">WordPress<\/a> \u0438\u043c\u0435\u0435\u0442 \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u0443\u044e \u043f\u043e\u0438\u0441\u043a\u043e\u0432\u0443\u044e \u0441\u0438\u0441\u0442\u0435\u043c\u0443, \u043e\u0434\u043d\u0430\u043a\u043e \u043e\u043d\u0430 \u043d\u0435 \u0442\u0430\u043a\u0430\u044f \u0441\u043b\u043e\u0436\u043d\u0430\u044f, \u043a\u0430\u043a \u043f\u043e\u0438\u0441\u043a\u043e\u0432\u0430\u044f \u0441\u0438\u0441\u0442\u0435\u043c\u0430 Google (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043f\u043e\u0438\u0441\u043a WP \u043d\u0435 \u0432\u043a\u043b\u044e\u0447\u0430\u0435\u0442 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0438). \u0427\u0442\u043e\u0431\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u0442\u043e\u0440\u043e\u043d\u043d\u044e\u044e \u043f\u043e\u0438\u0441\u043a\u043e\u0432\u0443\u044e \u0441\u0438\u0441\u0442\u0435\u043c\u0443, \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0432\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043a\u043e\u0434 \u0432 \u0444\u0430\u0439\u043b \u0448\u0430\u0431\u043b\u043e\u043d\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, <strong>functions.php<\/strong><\/p>\n<pre><code>function wp_use_google_search( $wp_query) {\n\u00a0 $s = ''; \u00a0\n\u00a0 if (isset($wp_query-&gt;query_vars['s'])) {\n\u00a0 \u00a0 $s = trim($wp_query-&gt;query_vars['s']);\n\u00a0 }\n\u00a0 if (!$s) { \u00a0\/\/ empty query returns\n\u00a0 \u00a0 return;\n\u00a0 }\n\u00a0 \/\/ get current host\n\u00a0 $host = strtolower($_SERVER['HTTP_HOST']);\n\u00a0 \n\u00a0 \/\/ use google \n\u00a0 $search_engine = '&lt;a class=\"vglnk\" target=\"_blank\" href=\"https:\/\/www.google.com\/search?q=\" rel=\"nofollow\"&gt;&lt;span&gt;https&lt;\/span&gt;&lt;span&gt;:\/\/&lt;\/span&gt;&lt;span&gt;www&lt;\/span&gt;&lt;span&gt;.&lt;\/span&gt;&lt;span&gt;google&lt;\/span&gt;&lt;span&gt;.&lt;\/span&gt;&lt;span&gt;com&lt;\/span&gt;&lt;span&gt;\/&lt;\/span&gt;&lt;span&gt;search&lt;\/span&gt;&lt;span&gt;?&lt;\/span&gt;&lt;span&gt;q&lt;\/span&gt;&lt;span&gt;=&lt;\/span&gt;&lt;\/a&gt;';\n\u00a0 \n\u00a0 \/\/ concatenate the query\n\u00a0 $query = urlencode($s. ' site:'. $host);\n\u00a0 \n\u00a0 \/\/ redirect to search engine\n\u00a0 wp_redirect($search_engine. $query);\n\u00a0 \n\u00a0 \/\/ end the page\n\u00a0 exit;\n}\n\u00a0\n\/\/ add customized search handler\nadd_action('parse_query', 'wp_use_google_search');<\/code><\/pre>\n<p>\u0415\u0449\u0435 \u043e\u0434\u043d\u043e \u043f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0441\u0442\u043e\u0440\u043e\u043d\u043d\u0435\u0439 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u043d\u043e\u0439 <a href=\"https:\/\/wordpress.mediadoma.com\/ru\/tendencii-internet-sajtov\/\" title=\"\u043f\u043e\u0438\u0441\u043a\u043e\u0432\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u044b\">\u043f\u043e\u0438\u0441\u043a\u043e\u0432\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u044b<\/a> \u0434\u043b\u044f \u0438\u043d\u0434\u0435\u043a\u0441\u0430\u0446\u0438\u0438 <a href=\"https:\/\/wordpress.mediadoma.com\/ru\/kak-pokazat-diagrammu-statistiki-ezhemesjachnogo-kolichestva-soobshhenij-v-wordpress\/\" title=\"\u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439\">\u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439<\/a> WordPress \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u043e\u043d\u0430 \u0441\u043d\u0438\u0436\u0430\u0435\u0442 \u043f\u0435\u0440\u0435\u0433\u0440\u0443\u0437\u043a\u0443 \u0432\u0430\u0448\u0435\u0433\u043e \u0441\u0435\u0440\u0432\u0435\u0440\u0430, \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e \u043f\u0440\u0438 \u0431\u043e\u043b\u044c\u0448\u043e\u043c \u0442\u0440\u0430\u0444\u0438\u043a\u0435 \u0438 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u043d\u043e\u0439 \u043f\u0440\u043e\u043f\u0443\u0441\u043a\u043d\u043e\u0439 \u0441\u043f\u043e\u0441\u043e\u0431\u043d\u043e\u0441\u0442\u0438. \u0412\u044b \u0442\u0430\u043a\u0436\u0435 \u043c\u043e\u0436\u0435\u0442\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u043f\u043e\u0438\u0441\u043a\u043e\u0432\u0443\u044e \u0441\u0438\u0441\u0442\u0435\u043c\u0443, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f google.co.uk \u0432\u043c\u0435\u0441\u0442\u043e <a href=\"https:\/\/google.com\/\" target=\"_blank\" rel=\"noopener nofollow\" class=\"external external_icon\">google.com<\/a>, \u0435\u0441\u043b\u0438 \u0432\u044b \u043e\u0440\u0438\u0435\u043d\u0442\u0438\u0440\u0443\u0435\u0442\u0435\u0441\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0430 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439 \u0438\u0437 \u0412\u0435\u043b\u0438\u043a\u043e\u0431\u0440\u0438\u0442\u0430\u043d\u0438\u0438.<\/p>\n<p>\u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u044b\u0439 \u0432\u044b\u0448\u0435 \u0444\u0430\u0439\u043b \u043f\u043e \u043e\u0431\u0449\u0435\u043c\u0443 \u043f\u0443\u0442\u0438, \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u043e\u043c\u0443 \u0434\u043b\u044f \u0432\u0441\u0435\u0445 \u0431\u043b\u043e\u0433\u043e\u0432 WordPress, \u0435\u0441\u043b\u0438 \u0443 \u0432\u0430\u0441 \u0435\u0441\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0431\u043b\u043e\u0433\u043e\u0432, \u0440\u0430\u0437\u043c\u0435\u0449\u0435\u043d\u043d\u044b\u0445 \u043d\u0430 \u043e\u0434\u043d\u043e\u043c \u0441\u0435\u0440\u0432\u0435\u0440\u0435 (<a href=\"https:\/\/helloacm.com\/ping-when-vpsdedicate-server-is-restarting\/\" target=\"_blank\" rel=\"noopener nofollow\" class=\"external external_icon\">VPS<\/a> \u0438\u043b\u0438 <a href=\"https:\/\/helloacm.com\/testing-the-hddssd-disk-speed-on-vpsdedicated-server\/\" target=\"_blank\" rel=\"noopener nofollow\" class=\"external external_icon\">\u0432\u044b\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0439 \u0441\u0435\u0440\u0432\u0435\u0440<\/a> ). \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u0432 \u043a\u0430\u0436\u0434\u044b\u0439 <strong>\u0444\u0430\u0439\u043b functions.php<\/strong> <a href=\"https:\/\/wordpress.mediadoma.com\/ru\/detskaja-tema-wordpress-vse-chto-vam-nuzhno-znat\/\" title=\"\u0434\u043e\u0447\u0435\u0440\u043d\u0435\u0439 \u0442\u0435\u043c\u044b\">\u0434\u043e\u0447\u0435\u0440\u043d\u0435\u0439 \u0442\u0435\u043c\u044b<\/a> \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u0440\u043e\u0441\u0442\u043e \u0432\u043a\u043b\u044e\u0447\u0438\u0442\u044c:<\/p>\n<pre><code>\/\/ Assume we save the above function in file \/commom\/path\/to\/wp_search.php\nrequire('\/commom\/path\/to\/wp_search.php');<\/code><\/pre>\n<p>\u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435, \u0443\u0431\u0435\u0434\u0438\u0442\u0435\u0441\u044c, \u0447\u0442\u043e \u0432\u044b \u043d\u0435 \u0437\u0430\u0431\u044b\u043b\u0438 <strong>&lt;?php<\/strong> (\u0432 \u043d\u0430\u0447\u0430\u043b\u0435 \u0444\u0430\u0439\u043b\u0430 PHP) .. \u0438 <strong>?&gt;<\/strong> (\u043d\u0435\u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u0442\u0435\u0433 \u043a\u043e\u043d\u0446\u0430 \u0444\u0430\u0439\u043b\u0430), \u043a\u043e\u0433\u0434\u0430 \u0432\u044b \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u0442\u0435 \u0432\u044b\u0448\u0435\u0443\u043a\u0430\u0437\u0430\u043d\u043d\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u043c \u0444\u0430\u0439\u043b\u0435 php.<\/p>\n<p><div id=\"PostUnique_PostSource\" style=\"padding-top: 50px\">\u0418\u0441\u0442\u043e\u0447\u043d\u0438\u043a \u0437\u0430\u043f\u0438\u0441\u0438:  <a target=\"_blank\" rel=\"noopener nofollow\" href=\"\/\/helloacm.com\" class=\"external external_icon\">helloacm.com<\/a><\/div><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u041a\u0430\u043a \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u043f\u043e\u0438\u0441\u043a\u043e\u0432\u0443\u044e \u0441\u0438\u0441\u0442\u0435\u043c\u0443 \u0434\u043b\u044f WordPress?<\/p>\n","protected":false},"author":1,"featured_media":223885,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":"","_wp_rev_ctl_limit":""},"categories":[809,870,900,726,618,850],"tags":[1171],"class_list":["post-220083","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-php-ru","category-wordpress-ru","category-kod-2","category-rozrobnyk-ru","category-rukovodstvo-dlja-nachinajushhih","category-uchebniki-ru","tag-affiai-ru"],"_links":{"self":[{"href":"https:\/\/wordpress.mediadoma.com\/ru\/wp-json\/wp\/v2\/posts\/220083","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wordpress.mediadoma.com\/ru\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/wordpress.mediadoma.com\/ru\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/wordpress.mediadoma.com\/ru\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/wordpress.mediadoma.com\/ru\/wp-json\/wp\/v2\/comments?post=220083"}],"version-history":[{"count":0,"href":"https:\/\/wordpress.mediadoma.com\/ru\/wp-json\/wp\/v2\/posts\/220083\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/wordpress.mediadoma.com\/ru\/wp-json\/wp\/v2\/media\/223885"}],"wp:attachment":[{"href":"https:\/\/wordpress.mediadoma.com\/ru\/wp-json\/wp\/v2\/media?parent=220083"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/wordpress.mediadoma.com\/ru\/wp-json\/wp\/v2\/categories?post=220083"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/wordpress.mediadoma.com\/ru\/wp-json\/wp\/v2\/tags?post=220083"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}