Logo: Wp Hardening Best Practices

Wp Hardening Best Practices

Organisatioun
wpultimatesecurity
wp-hardening-best-practices

Verwenden Sie dies, wann Dir eng WordPress-Säit konfiguréieren oder méi sécher maache wëllt, wp-config.php ännert, .htaccess- oder nginx-Regelen schreift, Dateiberechtigunge festleet oder Sécherheet bei der Bereetstellung beréit. Ëmfaasst Sécherheetsschlësselen, DISALLOW_FILE_EDIT, FORCE_SSL_ADMIN, d'Deaktivéiere vun der Debug-Ausgab, d'Blockéiere vun der PHP-Ausféierung am Uploads-Dossier, de Schutz vu sensibelen Dateien an Dateiberechtigunge mam minimale néidege Recht. Gitt proaktiv vir, wann Dir d'Konfiguratioun vun enger Säit opsetzt oder iwwerpréift.

Add to TypingMind

Iwwersiicht

Editeurwpultimatesecurity
RepositoryWordPress-Security-Skills
Skill-Nummwp-hardening-best-practices
Stären
54
Forks
3
Matgeliwwert Dateien
4
LizenzMIT
Linken
  • Instruktiounen am Markdown-Format

    Eng SKILL.md-Datei, déi de Modell bei Bedarf luet, soudatt nëmmen Token ufalen, wann eng Ufro tatsächlech dozou passt.

  • Funktionéiert mat all LLM

    KI-Skills si reng Markdown, keen ubidderspezifesche Code. Dofir funktionéiert dëse Skill mat GPT, Claude, Gemini, Grok oder engem lokale Modell.

  • 4 matgeliwwert Dateien

    Skripten, Virlagen a Referenzen, déi de Modell beim Schaffe liese kann. D'Dateie kënnen nëmme gelies ginn a ginn ni ausgeféiert.

  • Open Source

    wpultimatesecurity huet de Skill op GitHub verëffentlecht. Liest de Quelltext, ier Dir de Skill installéiert.

Installatioun

Installéiert de KI-Skill Wp Hardening Best Practices an TypingMind, fir e mat all LLM ze benotzen, oder setzt en an en anere KI-Agent an, deen SKILL.md liest.

1

An TypingMind installéieren

TypingMind installéiert e Skill direkt aus sengem GitHub-Dossier — dobäi gëtt SKILL.md gelies, d'Ressourcedateie gi gebëndelt an d'Resultat gëtt lokal gespäichert.

  1. Maacht d'App op a gitt op Plugins → Skills.
  2. Wielt „Vu GitHub installéieren“.
  3. Pecht d'URL vum Skill-Dossier, déi hei drënner steet, an a bestätegt d'Installatioun.
    https://github.com/wpultimatesecurity/WordPress-Security-Skills/tree/dev/skills/wp-hardening-best-practices
  4. Aktivéiert de Skill an all Chat, an deem Dir e benotze wëllt.
Plugins → Skills → Skill derbäisetzen → Iwwer eng GitHub-URL. Pecht dann d'URL vum Dossier an a klickt op Weider.
2

An engem anere KI-Agent installéieren

All KI-Agent, deen d'Format Agent Skills liest, kann dëse Skill benotzen — kopéiert den Dossier an d'Skill-Verzeechnes vun deem KI-Agent.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/wpultimatesecurity/WordPress-Security-Skills.git /tmp/WordPress-Security-Skills
mkdir -p .claude/skills
cp -r /tmp/WordPress-Security-Skills/skills/wp-hardening-best-practices .claude/skills/wp-hardening-best-practices
Start Claude Code nom Kopéieren nei, fir datt den neie Skill erkannt gëtt.

An TypingMind benotzen

Aktivéiert Wp Hardening Best Practices an engem Chat vun TypingMind, an de Modell iwwerhëlt de Rescht. Den Numm an d'Beschreiwung stinn am System-Prompt. Soubal eng Ufro dozou passt, luet de Modell déi komplett Instruktioune selwer — Dir musst de Skill ni manuell opruffen, an et fale keng Token un, bis en tatsächlech benotzt gëtt.

De Modell luet Wp Hardening Best Practices automatesch, soubal eng Ufro dozou passt.

Funktionéiert mat all KI-Modell

KI-Skills si reng Markdown-Instruktiounen amplaz vun ubidderspezifeschem Code. Dofir ass Wp Hardening Best Practices net un de Modell gebonnen, fir deen de Skill geschriwwe gouf. Installéiert en eemol an TypingMind a benotzt e mat GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama oder engem lokale Modell, deen Dir selwer bedreift — alles mat Ären eegenen API-Schlësselen.

  • Gëtt nëmme gelueden, wann et néideg ass

    De System-Prompt enthält nëmmen den Numm an d'Beschreiwung. D'Instruktioune gi bei der éischter passender Ufro gelueden, soudatt en onbenotzte Skill näischt kascht.

  • De Modell am lafende Chat wiesselen

    Well de Skill aus Instruktiounen amplaz vu Code besteet, funktionéiert en och no engem Modellwiessel — den nächste Modell liest déi selwecht SKILL.md-Datei.

Skill-Instruktiounen

Dëst ass den Inhalt vu SKILL.md, deen de Modell luet. Liest e virun der Installatioun — e Skill besteet aus Instruktiounen, déi Äre Modell befollegt.

WordPress hardening best practices

When to use this skill

Use this skill for site/environment configuration, as opposed to plugin code:

  • Editing wp-config.php (keys, constants, debug).
  • Writing/reviewing .htaccess (Apache) or server-block (nginx) rules.
  • Setting filesystem permissions and ownership.
  • Locking down wp-admin, XML-RPC, REST user enumeration, and the uploads dir.
  • Pre-launch hardening checklists and deployment review.

This complements the secure-coding skills: even perfect code runs on a host that must be configured to fail safely.

Core principles (and why they matter)

  1. Disable in-dashboard file editing in production. DISALLOW_FILE_EDIT removes the plugin/theme editor — a single compromised admin session otherwise becomes code execution.
  2. Force TLS for admin and logins. FORCE_SSL_ADMIN stops credentials and cookies traveling in cleartext.
  3. Never display errors in production. Stack traces leak paths, queries, and secrets. WP_DEBUG off, display_errors off; log to a non-web-readable file if needed.
  4. Block PHP execution where only data should live. An attacker who slips a PHP file into wp-content/uploads gets RCE unless the server refuses to execute it there.
  5. Protect sensitive files. wp-config.php, .htaccess, readme.html, debug.log, and dotfiles should not be web-readable.
  6. Least privilege on the filesystem. Files 644, directories 755, wp-config.php 640/600; web server should not own files it doesn't need to write.
  7. Unique, strong security keys/salts. They invalidate stolen cookies; regenerate if leaked.
  8. Reduce attack surface. Disable XML-RPC if unused, block user enumeration, keep core/ plugins/themes updated, remove unused plugins.

Step-by-step implementation

  1. In wp-config.php: set unique salts, DISALLOW_FILE_EDIT, FORCE_SSL_ADMIN, disable debug display; optionally WP_AUTO_UPDATE_CORE, DISALLOW_FILE_MODS for locked builds.
  2. Place wp-config.php permissions at 640/600; ensure it is above or protected from the web root.
  3. Add server rules to deny PHP in uploads, protect sensitive files, and (optionally) restrict wp-admin/xmlrpc.php.
  4. Set file/dir permissions to least privilege.
  5. Keep everything updated; remove what you don't use.
  6. Add abuse controls for public surfaces: comment moderation on, pingbacks off if unused, and — for bot-heavy sites — CAPTCHA/Turnstile on login and registration via an established plugin (hand-rolled CAPTCHAs fail in both directions). Pair with the login throttle from authentication-session-security; XML-RPC stays off unless needed.

Supporting references

ReferenceLoad when
WordPress hardening checklistBefore final verification of the wordpress hardening controls.
Pre-launch (go-live) checklistReviewing a production launch across configuration, code, data, and operations.
Apache and nginx hardening rulesImplementing server hardening for sensitive files, uploads, and restricted endpoints.
Hardened wp-config.php constantsImplementing the wp-config.php hardening flow for salts, HTTPS, debugging, editing, and updates.

Common AI mistakes / anti-patterns

Mistake 1 — Leaving debug output on in production

php
// ❌ Insecure: errors rendered to visitors leak paths, SQL, secrets.
define( 'WP_DEBUG', true );
define( 'WP_DEBUG_DISPLAY', true );
php
// ✅ Secure: log privately, never display, in production.
define( 'WP_DEBUG', false );
// If you must debug on a live box, at least never display:
@ini_set( 'display_errors', '0' );
define( 'WP_DEBUG_DISPLAY', false );
define( 'WP_DEBUG_LOG', true ); // writes to wp-content/debug.log — block it from the web

Mistake 2 — Allowing the dashboard file editor

php
// ❌ Risky: compromised admin = arbitrary PHP via Appearance/Plugins editor.
// (default: editor enabled)
php
// ✅ Secure: disable file editing (and optionally all file mods).
define( 'DISALLOW_FILE_EDIT', true );
// Fully locked deploy (no plugin/theme install/update via UI):
define( 'DISALLOW_FILE_MODS', true );

Mistake 3 — 777 permissions "to make it work"

bash
# ❌ Insecure: world-writable lets any local process modify your site.
chmod -R 777 wp-content
bash
# ✅ Secure: least privilege.
find . -type d -exec chmod 755 {} \;
find . -type f -exec chmod 644 {} \;
chmod 640 wp-config.php

Mistake 4 — Uploads directory that executes PHP

apache
# ❌ Insecure: a smuggled shell.php in uploads runs.
# (no restriction)
apache
# ✅ Secure: deny PHP execution in uploads (Apache). Place in wp-content/uploads/.htaccess
<FilesMatch "\.(?i:php|php\d|phtml|phar)$">
    Require all denied
</FilesMatch>

Mistake 5 — Default/duplicated security keys

php
// ❌ Insecure: placeholder salts (or copied between sites).
define( 'AUTH_KEY', 'put your unique phrase here' );
php
// ✅ Secure: generate unique values from the official salt API and rotate if leaked.
// https://api.wordpress.org/secret-key/1.1/salt/
define( 'AUTH_KEY', '...64 random chars...' );
// (all eight: AUTH_KEY/SALT, SECURE_AUTH_KEY/SALT, LOGGED_IN_KEY/SALT, NONCE_KEY/SALT)

Mistake 6 — Leaving XML-RPC enabled when unused

php
// ❌ Risky: XML-RPC is a brute-force and pingback amplification vector if not needed.
// (default: enabled)
php
// ✅ Secure: disable XML-RPC entirely if the site does not need it.
add_filter( 'xmlrpc_enabled', '__return_false' );
// Or block at the server level (see htaccess-hardening.conf).

Mistake 7 — Allowing REST user enumeration

bash
# ❌ Risky: /wp-json/wp/v2/users/ reveals usernames to unauthenticated visitors.
curl https://example.com/wp-json/wp/v2/users/
php
// ✅ Safer: require authentication for the users endpoint.
add_filter( 'rest_endpoints', function ( $endpoints ) {
    if ( isset( $endpoints['/wp/v2/users'] ) ) {
        $endpoints['/wp/v2/users'][0]['permission_callback'] = static function () {
            return is_user_logged_in();
        };
    }
    return $endpoints;
} );

Mistake 8 — Application Passwords enabled without review

Application Passwords (WordPress 5.6+) are powerful for integrations but create a long-lived credential surface. Disable them if unused, or restrict them to users who actually need machine access.

php
// ✅ Secure: disable Application Passwords if the site does not use them.
add_filter( 'wp_is_application_passwords_available', '__return_false' );

Related: see the secrets-credentials-management skill for storing and handling API keys and tokens safely. See the security-headers-csp skill for application-level security headers (HSTS belongs in this skill's server config; the rest is code-level), and the dependency-supply-chain-security skill for keeping bundled libraries and CDN assets from rotting.

Correct code examples

Hardened wp-config.php constants are in references/wp-config-hardening.php; Apache and nginx rules (deny PHP in uploads, protect wp-config.php/.htaccess/debug.log, limit xmlrpc.php) are in references/htaccess-hardening.conf; the consolidated pre-launch sweep is references/go-live-checklist.md.

Checklist

  • Unique, strong security keys/salts set (all eight).
  • DISALLOW_FILE_EDIT enabled in production.
  • FORCE_SSL_ADMIN enabled; site served over HTTPS.
  • WP_DEBUG/WP_DEBUG_DISPLAY off in production; logs not web-readable.
  • PHP execution denied in wp-content/uploads.
  • wp-config.php, .htaccess, debug.log, dotfiles not web-accessible.
  • Permissions least-privilege: dirs 755, files 644, wp-config.php 640/600.
  • XML-RPC disabled/limited if unused; user enumeration limited.
  • Core, plugins, themes kept updated; unused extensions removed.
  • Admin accounts use strong passwords + 2FA where possible.

Official references

Matgeliwwert Dateien

De Modell liest dës Dateie bei Bedarf, wärend de Skill gelueden ass. Si ginn als liesbar Dateie bereetgestallt a ginn ni ausgeféiert.

Heefeg gestallte Froen

Wat mécht de KI-Skill Wp Hardening Best Practices?

Verwenden Sie dies, wann Dir eng WordPress-Säit konfiguréieren oder méi sécher maache wëllt, wp-config.php ännert, .htaccess- oder nginx-Regelen schreift, Dateiberechtigunge festleet oder Sécherheet bei der Bereetstellung beréit. Ëmfaasst Sécherheetsschlësselen, DISALLOW_FILE_EDIT, FORCE_SSL_ADMIN, d'Deaktivéiere vun der Debug-Ausgab, d'Blockéiere vun der PHP-Ausféierung am Uploads-Dossier, de Schutz vu sensibelen Dateien an Dateiberechtigunge mam minimale néidege Recht. Gitt proaktiv vir, wann Dir d'Konfiguratioun vun enger Säit opsetzt oder iwwerpréift.

Firwat Wp Hardening Best Practices op TypingMind benotzen?

Well Dir en eemol installéiert a mat all Modell benotze kënnt. Wp Hardening Best Practices besteet aus einfachem Markdown amplaz vun ubidderspezifeschem Code. Dee selwechte Skill funktionéiert also mat GPT-5, Claude, Gemini, Grok oder engem lokale Modell – an Dir kënnt de Modell matzen am Chat wiesselen, ouni datt de Skill ophält ze funktionéieren. TypingMind benotzt Är eegen API-Schlësselen, sou datt Dir d'Ubidder direkt bezuelt, amplaz en Abonnement pro Benotzerplaz ze bezuelen. Är Skills a Chats bleiwen an Ärem eegene Späicher.

Wéi installéieren ech Wp Hardening Best Practices an TypingMind?

Maacht an TypingMind Plugins → Skills → Vu GitHub installéieren op a setzt https://github.com/wpultimatesecurity/WordPress-Security-Skills/tree/dev/skills/wp-hardening-best-practices an. TypingMind liest d'Datei SKILL.md, bëndelt déi zougehéiereg Dateien an installéiert dat Ganzt als Skill, deen Dir pro Chat aktivéiere kënnt.

Wéi eng KI-Modeller kënnen Wp Hardening Best Practices benotzen?

All Modell, deen Dir an TypingMind verbënnt. KI-Skills sinn einfach Markdown-Instruktiounen an net ubidderspezifesche Code. Dofir kënne GPT, Claude, Gemini, Grok a lokal Modeller dëse Skill lueden, wann eng Ufro dozou passt.

Wéi vill KI-Modeller kann ech mat Wp Hardening Best Practices benotzen?

Esou vill wéi Dir wëllt. Soulaang e Modell Skills ënnerstëtzt, kënnt Dir Wp Hardening Best Practices domat benotzen – zum Beispill mat GPT, Claude, Gemini, Grok, DeepSeek, Mistral oder Llama – alles op TypingMind mat Ären eegenen API-Schlësselen.

Ass de KI-Skill Wp Hardening Best Practices gratis?

Jo. wpultimatesecurity huet de Skill ënner der Lizenz MIT op GitHub publizéiert. Dir bezuelt nëmmen Ären eegene KI-Ubidder fir d'Token, déi Dir benotzt.

Wat si KI-Skills?

E KI-Skill ass e weiderverwendbare Pak vun Instruktiounen, deen engem KI-Modell bäibréngt, wéi en eng bestëmmt Aufgab erfëllt. E follegt dem oppenen Agent Skills-Format: eng Datei SKILL.md mat engem Numm an enger Beschreiwung, plus all Scripten, Virlagen oder Referenzdateien, déi de Modell eventuell brauch. De Modell liest d'Instruktiounen eréischt, wann Är Ufro zum Skill passt. En installéierte Skill kascht also näischt, bis e benotzt gëtt.

Wéi ënnerscheede sech KI-Skills vu Plugins oder MCP-Serveren?

E Plugin oder MCP-Server gëtt engem Modell nei Tools, déi en opruffe kann – Code, deen iergendwou leeft an e Resultat zeréckgëtt. E KI-Skill gëtt dem Modell dogéint Wëssen an eng Virgoensweis: wéi en eng Aufgab ugeet, wéi eng Schrëtt e maache soll a wéi eng gutt Ausgab ausgesäit. Skills bestinn aus einfachem Markdown, brauche kee Server, keen API-Schlëssel a kee Lafzäitëmfeld a funktionéiere mat all Modell.

Alleguer weisen

Elo Ären eegene KI-Aarbechtsberäich ariichten

Abonnéiert Iech op eisen Newsletter, fir iwwer nei Funktiounen an zukünfteg Gewënnspiller informéiert ze ginn 👇