• I have a client using your calendar and their bandwidth gets eaten up by bots accessing every day a gagillion times

    In the log there is a lot of this kind of thing:

    “GET /my-calendar/?time=week&mcat=4,3&yr=2025&cid=my-calendar&dy=22&month=6 HTTP/1.1” 302 304 “

    and

    GET /my-calendar/?time=day&format=list&dy=07&yr=2025&month=06&cid=my-calendar&mcat=2 HTTP/1.1″ 302 318

    this causes the site to go down at some point (CPU strain or bandwidth limits)

    Anything in the settings to avoid this kind of thing or is it just robots.txt and blocking IPs?

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Joe Dolson

    (@joedolson)

    There’s nothing in the code; everything that can be done in the code is already there (nofollow, noindex, etc.). But the bots that are causing problems are largely AI crawlers, and they mostly ignore bot directions, causing these kinds of issues.

    So yeah, pretty much robots.txt, server directives, and blocking IPs.

    We just need the calendar to limit the viewable events such as from current day forward 365 days or something like that. No one needs to see beyond that.

    I just did this….

    If the current year is 2025 (can view all of 2024, 2025, 2026 but no other years.)
    If the current year is 2026 (can view all of 2025, 2026, 2027 but no other years.)

    You can adjust the years if needed for min / max it limits bots as well as humans but should help keep it from scanning all of your way old and way future events.

    Add the following file to your wordpress:
    wp-content/mu-plugins/calendar-year-guard.php

    Paste:

    <?php
    /**
    * Plugin Name: Calendar Year Guard
    * Description: Blocks abusive My Calendar year crawling with dynamic rolling limits.
    */

    add_action('template_redirect', function () {

    // Only act if a year parameter exists
    if (!isset($_GET['yr'])) {
    return;
    }

    // Sanitize year
    $yr = (int) $_GET['yr'];
    if ($yr <= 0) {
    return;
    }

    // Rolling window: last year → next 1 years
    $current = (int) date('Y');
    $min = $current - 1;
    $max = $current + 1;

    if ($yr < $min || $yr > $max) {
    status_header(410); // "Gone" tells bots to stop forever
    nocache_headers();
    exit;
    }

    }, 1); // priority 1 = run as early as possible
    • This reply was modified 4 months, 3 weeks ago by Tech01.
Viewing 3 replies - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.