| 开发者 | xaviercode |
|---|---|
| 更新时间 | 2026年11月15日 19:26 |
| PHP版本: | 7.4 及以上 |
| WordPress版本: | 7.1 |
| 版权: | GPLv2 or later |
| 版权网址: | 版权信息 |
The fine print, so that nobody relies on more than is there:
The block editor, yes. People who work on the site, and apps that sign in as them with an application password, still get the full list of what the site can do. A signed-in customer or subscriber gets the answer without the list, like a visitor. The list of user accounts stays readable to anybody who is signed in, as WordPress has it. Only visitors lose it. One thing changes for apps. An app that signs in with the ordinary password of an account that has two-step sign-in on is refused: give it an application password instead (see "What about apps and services that sign in with my password?" below).
No. The author's display name still shows. Only the link behind it now points to the home page instead of an author page.
This plugin only removes authors from WordPress's built-in sitemap. Turn off author sitemaps in your SEO plugin too.
A few outside apps, and scripts in some themes, read the list at /wp-json/ without signing in, to find out what the site offers. Untick "Hide the list of what your site can do from visitors" and it is as before. A developer can instead keep one part of the list open with the doctorx_hardening_open_rest_namespaces filter.
Any app that makes six-digit sign-in codes that change every 30 seconds. Your phone's app shop has several free ones, and most password managers do it too. Nothing has to be bought and no account has to be opened anywhere.
Type one of your backup codes where the sign-in page asks for the six-digit code. Each works once. Then switch two-step sign-in off under Users (or Profile) → Two-step sign-in, with another backup code, and set it up again on the new phone.
Somebody who may edit your account (on most sites, another administrator) can switch two-step sign-in off for you: Users, your name, "Switch it off for this account". An email about it goes to your address.
If you are the only administrator, add this line to wp-config.php, above the line that says "That's all, stop editing" (your web host can do this for you):
define( 'DOCTORX_HARDENING_NO_TWO_STEP', true );
Nobody is asked for a code while the line is there, on any account: every account opens with its password alone. So do it only when nobody else can know your password or the password of any other account that can change the site (if in doubt, have new passwords set first), and for as short a time as you can. Somebody who signs in while the line is there stays signed in after it is taken out, until they sign out or their password is changed. Sign in, open Users → Two-step sign-in, and press "Switch two-step sign-in off": while the line is there, that button asks for no code. Set it up again with your new phone, and take the line out.
Then somebody typed your password correctly and guessed at the code. The lock stopped the guessing. Use "Lost your password?" on the sign-in page to set a new password: that shuts them out and opens the lock, and you sign in with your new password and a code as usual. If the email with the link does not arrive, another administrator can set a new password for you on your profile (Users, your name), which opens the lock too. If you are the only administrator, ask your web host to set a new password for your account: hosts can do that without signing in to the site. The stranger is then out, and you sign in with the new password and a code (if the lock is still on, it opens at the time the page shows). Do not add the wp-config.php line from the answer above while somebody else knows your password. That line switches the second step off for every account, so the stranger would be signed in with the password alone. Change the password first. Use the line only for a lost phone. If your site's "Lost your password?" page belongs to a shop or membership plugin, and your WordPress is a release from before November 2024, a password set there may not open the lock. It then opens at the time shown, or when the password is changed on the profile screen.
The codes depend on the time. If everybody's codes fail at once, the clock of the website's server is probably wrong by more than half a minute: ask your web host to check it. If only yours fail, check that your phone sets its clock automatically.
Each person switches it on for their own account. Settings → Hardening shows how many of the site's administrators have it on. To make it compulsory for some roles, from a date, use "Two-step sign-in required" on Settings → Hardening → Sign-in and server.
An account with two-step sign-in can no longer be used with just its password by a program (XML-RPC, a script, a sign-in box that works without loading a page): there would be nowhere to ask for the code. Give each app its own application password, at the bottom of your profile (if there is no "Application Passwords" section there, another plugin or your web host has switched them off). That is safer anyway: you can take one app's key away without changing your password.
The key each app shares with the site is kept encrypted with your site's security keys. When those keys change (after a break-in, or because a host or plugin does it on a schedule), the codes can no longer be checked. The plugin notices at the next visit to the sign-in page and writes to everybody with two-step sign-in, and the page that asks for the code says what happened. Settings → Hardening says for thirty days what was done and whether everybody could be reached. (If the site's address or its folder changed at the same time, as on a copy of the site, nobody is written to. The plugin keeps a mark of the place for this, not the address, so that a copy made by replacing the address throughout the database is still told from the site itself.) Sign in with a backup code, then set it up again or switch it off with another backup code: either takes two minutes. Backup codes are not affected by the change. If a host or a plugin changes the keys on a schedule, this happens every time. Ask them to stop, or two-step sign-in is not practical on that site.
At /.well-known/security.txt on your domain, which is where the standard puts it. It is served only when the site is on HTTPS and lives at the top of its domain, when a contact is set, and while its date is good. Some web servers refuse every address with "/." in it before WordPress is asked. The "Check that visitors can read it" button on the settings screen tells you, and your host can let that one address through. If a file of that name already lies on the server, it wins: the button tells you that too.
The standard requires a date, so that nobody reports a problem to an address that stopped being read years ago. A contact you give or change is good for 360 days. You get an email and a notice on Settings → Hardening 30 days before the end. Pressing Save on the settings screen then confirms the contact for another 360 days. If you do nothing, the file is taken down on that date and comes back the moment you press Save.
Wait until the time the sign-in page shows, or sign in from another network (a phone without Wi-Fi): only the address is paused, not your account. Or have your web host (or anyone with access to the server) do one of these:
wp doctorx-hardening unlock --all (or unlock YOUR_ADDRESS), or wp doctorx-hardening guard offdefine( 'DOCTORX_HARDENING_NO_LOCKOUT', true ); to wp-config.php, above "That's all, stop editing". Nobody is paused or counted while it is there, and Settings → Hardening reminds you to take it out.Sign in from another network (a phone without Wi-Fi) and lift the ban on Settings → Hardening → Sign-in and server, or run wp doctorx-hardening unban --all (or wp doctorx-hardening unlock ADDRESS, which lifts a sign-in pause and a ban of that address) on the server, or add define( 'DOCTORX_HARDENING_NO_PROBE_BAN', true ); to wp-config.php: nobody is banned or counted while it is there.
It was emailed to the site's administration address when it was set. Otherwise run wp doctorx-hardening door on the server to see it, wp doctorx-hardening door off to switch the door off, or add define( 'DOCTORX_HARDENING_NO_DOOR', true ); to wp-config.php: wp-login.php answers again at once.
No part of it changes what visitors, search engines or AI assistants read on your pages. The probe ban does not count a crawler. The Cloudflare rules leave every crawler Cloudflare verifies alone. The server lines do not name a crawler to turn away. "Hide the WordPress version" changes a few characters in the addresses of WordPress's own script files, nothing that is read.
They keep the day, the kind of thing that would have been blocked (the directive, such as script-src), the website it came from (only its origin, such as https://example.com), the path of the page without anything after a question mark, the browser family (such as Chrome or Firefox) and a count. They do not keep a visitor's address or full browser details, and each row goes after 30 days. The header is the report-only kind, so browsers load and run everything on the page as before. The report address takes only the shapes browsers send, small bodies and a limited number of reports a minute from one address. On a site with HTTPS, browsers send reports in small batches, about a minute after the page was seen. Switch it off on Settings → Hardening, Content policy reports, and pages made from then on carry no header. Pages kept by WP Super Cache, W3 Total Cache or LiteSpeed Cache are cleared at the same time. Clear any other page cache yourself.
When uploads holds a very large tree of picture folders (a feed's listing photos, say), Wordfence's scan walks every one of those folders and keeps what it walked in memory. On a big tree it can run out of memory and stop without finishing. With Wordfence active, this plugin looks once a day (and on its own screens) for top-level folders of uploads with 20,000 folders or more below them. The look stops counting at that number and stops after about one second in all, so it does not walk a big tree itself. The media library's year folders are not offered (nor, on a multisite network, the folders of its other sites). Other plugins can name their own picture folders with the filter doctorx_hardening_static_media_folders.
The screen then says what happens, what skipping gives up and why that is safe only when PHP cannot run in uploads. What you give up: nothing in those folders is looked at by the scan any more, so a .php or .htaccess file put there, or a page made to trick people, would not be flagged. Before the button "Skip these folders in Wordfence's scan" shows, press "Check again". It puts small test files in each folder (a plain .txt, and a .php, a .phtml and a .phar), fetches them as a visitor and deletes them at once. The .txt must come back first, which proves the fetch reached that folder on this server. Then each test file must be refused (or shown as text, not run). The files are fetched from this site's own server. When uploads is served from another address (a CDN, or "Full URL path to files"), the test uses the site's own address instead, and uploads kept outside the WordPress folder cannot be tested. A password in front of the site, a firewall page or another server answering can not tell, and the button stays hidden. A firewall in front of the server that refuses .php (a Cloudflare rule, say) can make the test say "refused" while the server behind it would run PHP: the server's own rule is what matters. On Apache that reads .htaccess files, an .htaccess put into a skipped folder could switch PHP back on there, and the scan would no longer see it. Put the rule in the server's own settings where you can. Each press tests up to five folders for at most 25 seconds. Press again for the rest. This test runs only when you press the button, not by itself. Otherwise the screen asks you to put the "No PHP in uploads" rule in place first (Server rules, on the Sign-in and server tab). Once folders are skipped, the screen warns when their test is more than 7 days old, with "Check again". On a multisite network only network administrators see this and can press the buttons, because Wordfence's list holds for the whole network.
The button adds two lines per folder to Wordfence's own "Exclude files from scan" list, through Wordfence itself: wp-content/uploads/<folder> (Wordfence then does not list the folder at all) and wp-content/uploads/<folder>/* (anything below it). The rest of your list stays exactly as it was, and Undo puts the list back. Nothing in Wordfence changes without the button, and without Wordfence none of this runs. Deleting this plugin leaves the lines in Wordfence's list. Remove them there if you want. This plugin's own daily self-check does not walk such a folder either. When a look runs out of time, the folders it did not reach go first next time and the folder it was counting goes last, counted again from the start. A folder cut short twice in a row with a quarter of the 20,000 folders already counted is taken as a large tree. So on a slow disk that has not been read for a while it may take a few looks (days) to see a large folder.
Its settings are removed (on a multisite network, on every site). So are the sign-in guard's settings, the paused and banned addresses and the sealed Cloudflare token. The rules already at Cloudflare stay there: remove them with Undo first if you want them gone. Everything kept for two-step sign-in on every account is removed too, and so is the activity record with its events. (Simple History's own tables, if you still have them, are left alone.) The down page files, the db-error.php this plugin wrote, the content policy reports, the visitor counts and the city file are removed too. Signing in then takes only the password again. Deactivating without deleting keeps everything for when you switch it back on. While it is deactivated nobody is asked for a code, and when it is deactivated on the Plugins screen everybody who had two-step sign-in is told by email.
Each event says what happened, when, who did it (a signed-in person, an anonymous visitor, WordPress itself, or WP-CLI), the address the request came from, the browser's name, and the details of what changed (a post's title before and after, a plugin's version before and after). Addresses are kept without their last part unless you choose to keep them whole. Events are removed after the number of days you choose (60 unless you change it), once a day, and the removal is itself recorded. Administrators read everything. Editors read the events about what they can change themselves. Addresses are shown to administrators only.
No. Switch the activity record on, then press "Bring in Simple History's events" on Settings → Hardening (or run "wp doctorx-hardening activity import"). Every event comes over with its date, address, details and who did it. Pressing it again brings in only what is new. Simple History's own tables are not changed, so switching back is reactivating it. Code written for Simple History ("do_action( 'simple_history_log', ... )") keeps being recorded once Simple History is gone.
Yes. On the activity record's "More settings" screen, add a destination: an email address, a Slack, Discord or Microsoft Teams webhook, a Telegram bot, or any webhook. Then add a rule. It can be a ready one (security, content, updates, failed sign-ins, plugins installed, somebody made an administrator) or your own (kinds of events, the lowest level, who did it, words). "Alert me about events like these" on the record makes a rule from what you searched. Each rule sends at most the number of alerts an hour you set, and a run of failed sign-ins alerts at the 1st, 10th, 100th attempt. Nothing is sent until you switch alerts on.
Yes: syslog (this server's, or another over UDP, TCP or TLS), Datadog, Splunk or any webhook. Keys, tokens and passwords are kept sealed and are not shown again. Events are sent once the page has answered, at most 50 a request. What a request cannot send (more events, a destination that is down) waits, and is sent in order by a scheduled job that exists only while forwarding is on and something waits. At most 5,000 events wait for each destination. Past that the oldest are dropped, and the screen, wp doctorx-hardening activity forward list and the activity record say how many. Events made by backfill are not forwarded. Events dated in the past by hand also wait their turn (at most 500 a destination).
Delivery is "at least once": after a failure half-way an event can arrive twice. So every event carries a delivery id that a receiver can use to drop repeats. It is the "uid": your site, the event's number and its count. Webhooks also get it in the X-DRX-Event-Id header. Destinations on this server itself or on link-local addresses (such as a cloud metadata service) are refused. A destination's name is looked up once and the connection goes to the address that was checked. A name that cannot be found is not sent to. TLS certificates are checked, for syslog over TLS and for the database with TLS, against the certificates WordPress trusts. Code can name your own CA file with the filter doctorx_hardening_activity_ca_file. A website set up not to send (the line define( 'DOCTORX_HARDENING_MAY_CONNECT', false ); in wp-config.php) sends no alert, forwards nothing and looks nothing up.
Only if you choose how. It can use a database file on your server (MaxMind GeoLite2, DB-IP Lite or IPinfo's .mmdb), and then nothing leaves the server. Or it can use ipinfo.io with your own token, and then only when an administrator opens an address (not on a website set up not to send). Out of the box nothing is looked up.
Not for visitors: nothing of it runs on a page view. A failed sign-in costs one database write. A run of them from one address is counted on one line.
The activity record of that site and the notes kept on accounts for that site go with the site, as when the plugin is deleted. Two-step sign-in belongs to each account on the whole network, so it stays for the other sites. WordPress removes the site's settings and uploaded files itself.
Only the city and the country of each visitor, counted per day, for 31 days. No address, no visitor record and nothing that names a person is kept. The visitor's address is looked up in the city file on your server and then forgotten. To count each visitor once a day, the browser keeps a small cookie that holds only the date, the same for everybody. Search engines and other known crawlers, scripts, the site's own requests, sign-in pages, feeds and missing pages are not counted. Each page asks your site once a day to count the visitor (one small request to the site's own address), so pages served from a page cache are counted too. A visitor whose browser runs no scripts is not counted, and one whose browser refuses cookies is counted at each page. At most 30 visitors in 5 minutes are counted from one address. For that limit the site keeps a scrambled form of the address for 5 minutes, never the address itself. The look-up is made after that small answer is sent where the server allows it. The city file (about 120 MB) is kept in your uploads folder, in a folder closed to the web under a random name. On a network each site has its own switch, file and counts. "Delete the city database and the counts" removes all of it. While counting is on, a paragraph about it is added to the suggested text of your privacy policy (Settings → Privacy).