File: /opt/aphex/sites/cm4rums.com/wp-content/plugins/custom-robots/custom-robots.php
<?php
/**
* Plugin Name: Custom Robots.txt Append
* Description: Appends custom rules to the robots.txt file after SEO plugins.
* Version: 1.0
* Author: Predrag
*/
function custom_append_to_robots_txt( $output ) {
// Check if the custom entry is already in the output to prevent duplicates
if (strpos($output, '# Custom entry') === false) {
// Append custom rules to the robots.txt content
$output .= "\n# Custom entry\n";
$output .= "User-agent: *\n";
$output .= "Disallow: /*?\n";
}
return $output;
}
// Use a high priority number to make sure it runs after other plugins
add_filter( 'robots_txt', 'custom_append_to_robots_txt', 9999 );