wp-ajax-nopriv-visibility

Audit wp_ajax_nopriv_ handlers and harden WP_Query inputs to prevent private content leaks.

54|48|Updated Jul 19, 2017
One-click install
npx skills add https://github.com/WPDevelopers/essential-addons-for-elementor-lite --skill wp-ajax-nopriv-visibility
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: wp-ajax-nopriv-visibility
Source: https://github.com/WPDevelopers/essential-addons-for-elementor-lite/tree/main/.claude/skills/wp-ajax-nopriv-visibility
Command: npx skills add https://github.com/WPDevelopers/essential-addons-for-elementor-lite --skill wp-ajax-nopriv-visibility

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill identifies and mitigates the risk of unauthenticated exposure caused by wp_ajax_nopriv_ handlers that build WP_Query arguments from client input, potentially leaking private, draft, or trashed content to anonymous users.

Core Features & Use Cases

  • Auditing and pattern discovery: scans for wp_ajax_nopriv_ handlers, client-parsed query strings, and indicators of widened visibility.
  • Defensive fixes and guidance: provides a field-tested patch pattern to strip dangerous keys (e.g., post_status, perm, suppress_filters) and to safely default post_status to publish, with careful treatment of post_type.
  • Regression and validation guidance: includes checks to ensure narrowing keys are preserved, and whitelists are server-trusted when widening is truly necessary.

Quick Start

Audit the site's wp_ajax_nopriv handlers and apply the recommended hardening pattern to sanitize input and limit visibility.

Frequently Asked Questions about wp-ajax-nopriv-visibility

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I secure unauthenticated WordPress AJAX endpoints that might leak private content?▼

To secure unauthenticated WordPress AJAX endpoints, parse wp_ajax_nopriv_ handlers to identify WP_Query arguments built from user input, strip dangerous keys like post_status and perm, and default post_status to publish. This prevents anonymous users from accessing draft or private content.

Why does my wp_ajax_nopriv handler expose draft posts to anonymous users?▼

Your wp_ajax_nopriv handler exposes draft posts because WP_Query arguments are built directly from client input without sanitization. Removing dangerous query keys like post_status, perm, and suppress_filters, while enforcing safe defaults, prevents this unauthorized content exposure.

What is the best way to audit WordPress AJAX endpoints for private content leaks?▼

The best way to audit WordPress AJAX endpoints for private content leaks is to scan for wp_ajax_nopriv_ handlers that parse client query strings and check for indicators of widened visibility, ensuring any widened post_type whitelists are strictly server-trusted.

Can I use WP_Query in plugins without authentication safely?▼

You can use WP_Query in plugins without authentication safely by applying a hardening patch pattern that removes dangerous keys, safely defaults post_status to publish, and carefully treats post_type parameters to prevent exposing private, draft, or trashed content.

How do I patch a WordPress AJAX endpoint to prevent WP_Query visibility exploits?▼

To patch a WordPress AJAX endpoint against WP_Query visibility exploits, strip dangerous input keys like post_status and suppress_filters, enforce publish as the default post_status, and validate post_type against a strict server-side whitelist to ensure narrowing keys are preserved.

What limitations exist when hardening wp_ajax_nopriv endpoints that require widened visibility?▼

When hardening wp_ajax_nopriv endpoints that require widened visibility, the limitation is that any necessary post_type widening must use strictly server-trusted whitelists, ensuring narrowing keys are preserved and regression checks validate that private content remains inaccessible to anonymous users.