=== WP Pro Admin – Disable Comments, Lock Plugin Versions & Block Installs ===
Contributors: shazzad
Tags: disable comments, comment spam, disable updates, plugin updates, lockdown
Requires at least: 6.2
Tested up to: 7.0
Requires PHP: 7.4
Stable tag: 2.1.1
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Turn off comments, pin plugin versions, and block new installs. Every lock is instantly reversible. No ads, no nags, no notices.

== Description ==

Nothing appears on your site without you — no new comment, no new plugin, no new version.

WP Pro Admin gives you three locks. Each one is a single switch, each one starts working the
moment you turn it on, and **each one is instantly reversible**: switch it off and your site is
exactly as it was, with nothing to repair and no migration to run.

= Disable Comments =

One switch. Comments are off, everywhere. There is nothing to configure, on purpose.

* Comment forms disappear, existing comments are hidden, and the Comments menu, admin-bar bubble and dashboard widget go away.
* **Direct POSTs to `wp-comments-post.php` are refused.** Most plugins remove the comment form and stop there — spam bots never needed the form. Comment creation through the REST API is refused too.
* **Switching it on never writes to your database.** No `comment_status` column is touched, no comment is deleted. Turn it off and every comment is right where you left it.

There is also an optional cleanup button, which is the one thing in this plugin that deletes
anything:

* By default it removes only comments **already marked as spam or already in the trash** — junk you have rejected already. Approved and pending comments are left alone.
* Tick the box and it will delete approved and pending comments too. That is never the default and always requires confirmation.
* Either way it shows you the exact count first, asks you to confirm, and deletes in batches so a large site cannot time out.
* Comments attached to a trashed post are never deleted — they come back if you restore the post.

= Version Lock =

Pin any plugin to the version you have installed. Useful when an update breaks something, when
you have customised a plugin, or when a site simply must not move.

* One "Lock version" link on the Plugins screen. The update count, the update row, the Updates screen and the auto-update all stop mentioning it.
* **Locking does not mean going blind.** WP Pro Admin always shows you the version you pinned, the latest version available, and how far behind you are — and flags a pending update that looks like a security release rather than hiding it.
* If the plugin changes on disk later, the lock is reported as stale instead of quietly re-pinning to a version you never chose.
* No plugin file is ever written, moved or deleted. This is an update policy, not a package manager.

= Registration Lockdown =

Stops new user accounts being created — through the registration form, the REST API, or plugin
code. Creating a rogue administrator is what an attacker does first, because it outlives the
backdoor they came in through.

* Forces "Anyone can register" off **by filter**, so it stays off even if something flips the row in the database directly.
* Refuses creation of, or promotion to, **administrator**. This layer stops the actual attack and leaves ordinary customer registration alone, so it is on by default.
* Blocking accounts created by plugin code is available but **off by default** — it breaks WooCommerce checkout and membership plugins.
* Blocked administrator attempts are recorded, with the time and the requested username.

= Disable XML-RPC =

Closes the remote write API at `xmlrpc.php` and stops your site advertising it. Every method
goes, including `pingback.ping` and `system.multicall` — the one that lets a single request carry
hundreds of password guesses.

* If you use the Jetpack mobile app or a legacy remote publishing tool, leave this off.

= Disable File Editing =

Removes the built-in plugin and theme file editors. A stolen administrator session is otherwise
one click away from running arbitrary PHP on your site.

* The natural pair to Installation Lockdown: that stops new code arriving, this stops the code already there being rewritten.
* Not the `DISALLOW_FILE_EDIT` constant, so it is always reversible from the settings screen.

= Installation Lockdown =

Freeze what is installed. No new plugins or themes, no uploads, no updates — for anyone.

* Activating and deactivating what is already installed still works. This locks what is *on* the site, not what is *running*.
* Optionally allowlist a plugin or two that should keep updating, so your security plugin can stay current while everything else stays frozen.
* You can always switch it back off from the settings screen. A lock that traps you out of your own site is not a feature.

= What this plugin will never do =

* No advertisements. No upsell panels. No "review us" prompts. No dashboard notices of any kind.
* No telemetry, and no calling home.
* Nothing written to your content that outlives switching a feature off. The one exception is the
  comment cleanup button, which only ever runs when you click it and confirm it.

Those are not promises in a readme — the first and third are enforced by tests that fail the
build. If a future version ever adds a nag, the test suite goes red before it ships.

= Performance =

A feature you have not enabled registers **zero** hooks and loads zero assets. That is asserted by
a test that snapshots the entire WordPress hook graph before and after the plugin boots. Settings
live in a single autoloaded option — one row, not forty.

== Frequently Asked Questions ==

= Will this delete my comments? =

Not unless you ask it to. Turning Disable Comments on only hides them — a test asserts the comment
rows are untouched after a full enable-and-disable cycle.

There is a separate cleanup button that does delete, and it deletes **spam and trashed comments
only** unless you tick the box to include approved ones. It shows the exact count, asks you to
confirm, and cannot be undone.

= Can I turn it back off? =

Yes, instantly. Every feature works through WordPress filters, so nothing was written to your
database to undo. Disable the feature and your site is exactly as it was.

= Does this actually stop comment spam bots? =

Yes. Bots usually POST straight to `wp-comments-post.php` without ever loading your page, so
hiding the comment form does nothing. WP Pro Admin refuses those requests with a 403 before
WordPress processes them, and refuses comment creation through the REST API as well.

= If I lock a plugin, will I miss a security update? =

You will still be told about it. The settings screen lists every locked plugin with its pinned
version, the latest available version, and a flag when the pending update looks like a security
release. Detection is best-effort from the release notes, so treat it as a prompt to look rather
than a guarantee — but the plugin will never quietly hide it from you.

= Is Installation Lockdown a security feature? =

Not exactly, and it would be dishonest to say otherwise. It is enforced in PHP, so anyone with
filesystem, database or WP-CLI access can bypass it. It reliably stops accidents and casual
changes — a client installing something on a whim, an update applied without thinking. Treat it
as a policy guard, not a security boundary.

= Why not just use the DISALLOW_FILE_MODS constant? =

Because it cannot be switched off from the admin. Once it is in `wp-config.php` you need file
access to undo it, which strands people. Installation Lockdown filters capabilities instead, so
you can always turn it off from the settings screen. If you want the harder version, the constant
is still there and this plugin does not interfere with it.

= Will you add ads or a Pro version later? =

No ads, ever. A paid tier may exist one day, but everything described above stays free, and no
feature will be removed from the free version to create one.

== Screenshots ==

1. The settings screen — three cards, everything off by default.
2. Disable Comments, with the optional spam-and-trash cleanup.
3. The confirmation step before anything is deleted, showing the exact count.
4. The "Lock version" link on the Plugins screen.
5. Locked plugins, showing pinned version, latest version, and a flagged security release.
6. Installation Lockdown, with an allowlist.

== Changelog ==

= 2.1.1 =
Updates now arrive through your WordPress Updates screen — install once and future releases reach you like any other plugin update. No feature changes.

= 2.1.0 =
Three more locks, completing the set: no new users, no remote write API, no code edits.

* **Registration Lockdown** — no new accounts from the registration form, the REST API, or plugin code. The administrator guard is on by default; blocking plugin-created accounts is opt-in because it breaks WooCommerce checkout. Blocked administrator attempts are logged.
* **Disable XML-RPC** — closes `xmlrpc.php`, removes every method including `pingback.ping` and `system.multicall`, and strips the X-Pingback header and RSD link.
* **Disable File Editing** — removes the plugin and theme file editors by denying the capability, so it stays reversible from the settings screen rather than needing `DISALLOW_FILE_EDIT`.

= 2.0.0 =
**A complete rewrite.** Versions 1.x were an AI chat assistant for the WordPress admin. That
product is gone. WP Pro Admin is now a set of locks, sharing nothing but the name.

* **Disable Comments** — one switch, no settings. Rejects direct POSTs to `wp-comments-post.php` and REST comment creation, not just the form. Hides existing comments without writing to your database.
* **Version Lock** — pin any plugin to its installed version. Shows the pinned version, the latest available, and flags a pending security release rather than hiding it. Never touches a plugin file.
* **Installation Lockdown** — freeze installs, uploads and updates, with an optional allowlist so a security plugin can stay current. Always reversible from the settings screen.
* **Comment cleanup** — optional, confirmed, batched deletion of spam and trashed comments. WooCommerce order notes, webhook logs and product reviews are excluded unless you explicitly opt in; unrecognised comment types are never deleted.
* Every lock is instantly reversible — nothing is written that outlives switching a feature off, and a test asserts it.
* No ads, no upsells, no dashboard notices. Enforced by a test that fails the build.
* A disabled feature registers zero hooks. Also asserted by test.

== Upgrade Notice ==

= 2.1.1 =
Adds the update client so future releases install from the Updates screen. No feature changes.

= 2.1.0 =
Adds Registration Lockdown, Disable XML-RPC and Disable File Editing. All three start switched
off; nothing changes on your site until you turn one on.

= 2.0.0 =
Complete rewrite. The AI chat assistant is removed and replaced by three site locks. Your old
settings are cleared automatically on first load.
