HEX
Server: nginx/1.18.0
System: Linux m1-ws1-ams3 5.4.0-148-generic #165-Ubuntu SMP Tue Apr 18 08:53:12 UTC 2023 x86_64
User: root (0)
PHP: 7.4.33
Disabled: NONE
Upload Files
File: /opt/aphex/sites/tomtomsummer.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 );