mirror of
https://github.com/szepeviktor/wordpress-website-lifecycle.git
synced 2025-08-17 18:11:08 +08:00
Add gptbot
This commit is contained in:
parent
86fd3f9345
commit
9ef07fce06
2 changed files with 26 additions and 4 deletions
22
mu-plugins/_robots-gptbot.php
Normal file
22
mu-plugins/_robots-gptbot.php
Normal file
|
@ -0,0 +1,22 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* Plugin Name: Disallow GPTBot
|
||||
* Plugin URI: https://platform.openai.com/docs/gptbot
|
||||
*/
|
||||
|
||||
add_filter(
|
||||
'robots_txt',
|
||||
static function ($output, $is_public) {
|
||||
$lines = [
|
||||
'User-agent: GPTBot',
|
||||
'Disallow: /',
|
||||
];
|
||||
if (!$is_public) {
|
||||
return $output;
|
||||
}
|
||||
return implode("\n", $lines) . "\n\n" . $output;
|
||||
},
|
||||
-1,
|
||||
2
|
||||
);
|
|
@ -7,15 +7,15 @@
|
|||
|
||||
add_filter(
|
||||
'robots_txt',
|
||||
static function ($output, $isPublic) {
|
||||
static function ($output, $is_public) {
|
||||
$lines = [
|
||||
'User-agent: OSZKbot',
|
||||
'Disallow: /',
|
||||
];
|
||||
if ($isPublic) {
|
||||
return implode("\n", $lines) . "\n\n" . $output;
|
||||
if (!$is_public) {
|
||||
return $output;
|
||||
}
|
||||
return $output;
|
||||
return implode("\n", $lines) . "\n\n" . $output;
|
||||
},
|
||||
-1,
|
||||
2
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue