PortGate

Blueprints · WordPress

Beginner 5 min · Linux

WordPress disallow file edits

Stages the constants that turn off the theme and plugin editor and in-dashboard installs.

Live config

Baked-in protections

Step 1 · php

Constants

/root/portgate-blueprints/wp-config-hardening.php

Add these lines above the stop-editing marker in wp-config.php.

define('DISALLOW_FILE_EDIT', true);
define('DISALLOW_FILE_MODS', true);
define('FORCE_SSL_ADMIN', true);

Step 2 · bash

Read-only check

/root/portgate-blueprints/wp-config-check.sh

Prints status. It does not change the service.

#!/bin/sh
set -eu
if [ -f "/var/www/html/wp-config.php" ]; then
  grep -E "DISALLOW_FILE_EDIT|DISALLOW_FILE_MODS" "/var/www/html/wp-config.php" || echo "The constants are not in wp-config.php yet."
else
  echo "wp-config.php was not found."
fi