GoFuckYourself.com - Adult Webmaster Forum

GoFuckYourself.com - Adult Webmaster Forum (https://gfy.com/index.php)
-   Fucking Around & Business Discussion (https://gfy.com/forumdisplay.php?f=26)
-   -   Help: How to dissable or remove NOINDEX on wp-script theme? (https://gfy.com/showthread.php?t=1383358)

mightyjoe 04-13-2025 05:12 PM

Help: How to dissable or remove NOINDEX on wp-script theme?
 
We all know that wp-script has zero customer service.

Now I spent hours with chatgpt but no success. Also Yoast has no option to remove.

This <meta name='robots' content='noindex, follow' /> has all on SEARCH PAGE now I WANT TO DISSABLE that, PLEASE help me :thumbsup

I wonder why wp-script coded guy did that in auto. There should be an option to put or not.

PS: Pls dont ask me why I want to remove because serch page is blah blah, i want to remove it thats all

TheLegacy 04-13-2025 05:18 PM

what did chatgpt say about it? I asked the same question and got several answers.

also who do you host with?

EddyTheDog 04-13-2025 05:35 PM

Dumb question, but why can't you just delete it? - What happens?..

mightyjoe 04-13-2025 07:20 PM

Quote:

Originally Posted by TheLegacy (Post 23364249)
what did chatgpt say about it? I asked the same question and got several answers.

also who do you host with?

actually chatgpt figure it out for me after a looooot of insults, suggestions and questions. here are the code to go in fuunctions.php, it will removed the noindex in wp-script themes and replace with index, this works only in pages with ?s= and /search/

function replace_robots_meta_tag_for_search($buffer) {
// Check if the current page has a query string 's=' (search query)
if ( isset($_GET['s']) && !empty($_GET['s']) ) {
// Replace noindex with index in the robots meta tag
$buffer = preg_replace_callback(
'/<meta\s+name=[\'"]robots[\'"]\s+content=[\'"]noindex,\s*follow[\'"]\s*\/?>/i',
function($matches) {
return "<meta name='robots' content='index, follow' />";
},
$buffer
);
}
return $buffer;
}

function start_replace_robots_buffer_for_search() {
ob_start('replace_robots_meta_tag_for_search');
}
add_action('template_redirect', 'start_replace_robots_buffer_for_search');



function replace_robots_meta_tag_for_pretty_search($buffer) {
if ( is_search() ) {
// Replace noindex with index in the robots meta tag
$buffer = preg_replace_callback(
'/<meta\s+name=[\'"]robots[\'"]\s+content=[\'"]noindex,\s*follow[\'"]\s*\/?>/i',
function($matches) {
return "<meta name='robots' content='index, follow' />";
},
$buffer
);
}
return $buffer;
}

function start_replace_robots_buffer_for_pretty_search() {
ob_start('replace_robots_meta_tag_for_pretty_searc h');
}
add_action('template_redirect', 'start_replace_robots_buffer_for_pretty_search');


the upper one is for ?s=
and below that one is for /search/
so it works individually

mightyjoe 04-13-2025 07:21 PM

Quote:

Originally Posted by EddyTheDog (Post 23364252)
Dumb question, but why can't you just delete it? - What happens?..

if that can be simple, why not :1orglaugh

mightyjoe 04-13-2025 07:52 PM

and this is the code to noindex all the pages with ? except ?s=

chatgpt is great actually if you have clear prompt

function replace_robots_meta_tag_for_query_pages_except_sea rch($buffer) {
// Skip search pages (?s=)
if ( isset($_GET['s']) && !empty($_GET['s']) ) {
return $buffer;
}

// If the URL contains a query string
if ( strpos($_SERVER['REQUEST_URI'], '?') !== false ) {
// Replace any existing robots meta tag
$buffer = preg_replace(
'/<meta\s+name=[\'"]robots[\'"]\s+content=[\'"][^\'"]+[\'"]\s*\/?>/i',
"<meta name='robots' content='noindex, follow' />",
$buffer
);
}

return $buffer;
}

function start_replace_robots_buffer_for_query_pages_except _search() {
ob_start('replace_robots_meta_tag_for_query_pages_ except_search');
}
add_action('template_redirect', 'start_replace_robots_buffer_for_query_pages_excep t_search');

mightyjoe 04-13-2025 08:14 PM

but these codes works only if Yoast is ACTIVATED :p


All times are GMT -7. The time now is 03:08 PM.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc