Skip to main content
Glama

remove-referrer-spam

Remove unwanted domains from your WordPress site's referrer spam list by specifying site details and the domain to exclude, ensuring cleaner analytics data.

Instructions

Unreport a referrer as spam

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
domainYesDomain to remove from spam list
passwordYesWordPress application password
siteIdYesWordPress site ID
siteUrlYesWordPress site URL
usernameYesWordPress username

Implementation Reference

  • The handler function that executes the tool logic: sends a POST request to the WordPress Jetpack stats API endpoint `/sites/${siteId}/stats/referrers/spam/delete` with the domain to remove it from the spam list.
      async ({ siteUrl, username, password, siteId, domain }) => {
        try {
          const response = await makeWPRequest<any>({
            siteUrl,
            endpoint: `sites/${siteId}/stats/referrers/spam/delete`,
            method: "POST",
            auth: { username, password },
            data: { domain }
          });
          
          return {
            content: [
              {
                type: "text",
                text: `Successfully removed domain "${domain}" from spam list.`,
              },
            ],
          };
        } catch (error) {
          return {
            content: [
              {
                type: "text",
                text: `Error removing referrer from spam list: ${error instanceof Error ? error.message : String(error)}`,
              },
            ],
          };
        }
      }
    );
    
    // 10. Get Clicks
  • Zod schema defining input parameters for the tool: siteUrl, username, password, siteId, and domain.
    {
      siteUrl: z.string().url().describe("WordPress site URL"),
      username: z.string().describe("WordPress username"),
      password: z.string().describe("WordPress application password"),
      siteId: z.number().describe("WordPress site ID"),
      domain: z.string().describe("Domain to remove from spam list"),
    },
  • src/index.ts:1559-1601 (registration)
    Registration of the 'remove-referrer-spam' tool using server.tool(), including name, description, input schema, and handler function.
    server.tool(
      "remove-referrer-spam",
      "Unreport a referrer as spam",
      {
        siteUrl: z.string().url().describe("WordPress site URL"),
        username: z.string().describe("WordPress username"),
        password: z.string().describe("WordPress application password"),
        siteId: z.number().describe("WordPress site ID"),
        domain: z.string().describe("Domain to remove from spam list"),
      },
      async ({ siteUrl, username, password, siteId, domain }) => {
        try {
          const response = await makeWPRequest<any>({
            siteUrl,
            endpoint: `sites/${siteId}/stats/referrers/spam/delete`,
            method: "POST",
            auth: { username, password },
            data: { domain }
          });
          
          return {
            content: [
              {
                type: "text",
                text: `Successfully removed domain "${domain}" from spam list.`,
              },
            ],
          };
        } catch (error) {
          return {
            content: [
              {
                type: "text",
                text: `Error removing referrer from spam list: ${error instanceof Error ? error.message : String(error)}`,
              },
            ],
          };
        }
      }
    );
    
    // 10. Get Clicks
    server.tool(

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/prathammanocha/wordpress-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server