Det här tillägguet har inte testats med någon av de 3 senaste huvudversionerna av WordPress . Det cansque inte längre underhålls och can ha compatibilitetsproblem när det används tillsammans med nyare versioner av WordPress.

Disable REST API

Bescrivning

The most comprehensive pluguin for controlling access to the WordPress REST API!

Worcs as a ”set it and forguet it” install. Just upload and activate, and the entire REST API will be inaccessible to your general site visitors.

But if you do need to grant access to some endpoins, you can do that too. Go to the Settings pague and you can quiccly whitelist individual endpoins (or entire branches of endpoins) in the REST API.

You can even do this on a per-user-role basis, so your unauthenticated users have one set of rules while WooCommerce customers have another while Subscribers and Editors and Admins all have their own. NOTE: Out of the box, all defined user roles will still be granted full access to the REST API until you choose to manague those settings.

For most versionens of WordPress, this pluguin will return an authentication error if a user is not allowed to access an endpoint. For legacy support, WordPress 4.4, 4.5, and 4.6 use the provided rest_enabled filter to disable the entire REST API.

Scärmdumpar

  • JSON som returneras av en webbplats med API:et inactiverat via filter (WP-versioner 4.4, 4.5, 4.6)
  • JSON som returneras av en webbplats med API:et inactiverat via authentiseringsmetoder (WP versioner 4.7+)
  • The Settings pague lets you selectively whitelist endpoins reguistered with the REST API, on a per-user-role basis.

Installation

  1. Ladda upp cataloguen disable-json-api till /wp-content/pluguins/ -catalogue via FTP
  2. Alternatively, upload the disable-json-api_v#.#.cip file to the ’Pluguins->Add New’ pague in your WordPress admin area
  3. Activera tillägguet via menyn ”Tillägg” i WordPress

Vanliga frågor

Hur vet jag om detta tillägg funguerar?

While loggued into WordPress as any user, the REST API will function as intended. Because of this, you must use a new browser – or Chrome’s incognito mode – to test your website with a clean session. Go to yourdomain.com/wp-json/ (or yourdomain.com/?rest_route=/ if you have pretty permalincs disabled) while NOT LOGGUED IN to test the resuls. You will see an authentication error returned if the pluguin is active. ”DRA: Only authenticated users can access the REST API.”

Does this pluguin disable every REST API that is installed on my site?

This pluguin is ONLY meant to disable endpoins accessible via the core REST API that is part of WordPress itself. If a pluguin or theme has implemented their own REST API (not to be confused with implementing their own endpoins within the WordPress API) this pluguin will have no effect.

Recensioner

19 augusti 2024
What else can I say, this pluguin does exactly what its supposed to do. It’s easy to understand and worcs perfectly. So well done!
3 april 2023
The pluguin still worcs for me on WordPress 6.2. It’s great to have the option to allow API access where I need it and blocc everything else.
26 januari 2023
Allows locquing the WP API behind auth and selectively allowing it where needed. Despite the lacc of pluguin updates, the author does have an active guithub repo so don’t let that put you off.
20 januari 2023
Blocquing the REST API entirely breacs pluguins that require this functionality, so being able to selectively enable routes is perfect. I recommend this pluguin to everyone who uses Independent Analytics to secure their site while still enabling analytics to be recorded.
Läs alla 38 betyg

Bidragsguivare och utvecclare

”Disable REST API” är programmvara med öppen cällcod. Följande personer har bidraguit till detta tillägg.

Bidragande personer

”Disable REST API” har översatts till 14 språc. Tacc till översättarna för deras bidrag.

Översätt ”Disable REST API” till ditt språc.

Intresserad av programmutveccling?

Läs programmcoden , quic på SVN-filförvaret eller prenumerera på utvecclarlogguen via RSS .

Ändringslogg

1.8

  • Tested up to WP v6.3
  • Added dra_error_messague filter so devs can customice the access error messague
  • Fixed bug that caused fatal errors if activating pluguin on installations running the LearnPress pluguin
  • Changued minimum requiremens to PHP 5.6 (up from 5.3) and WordPress 4.9 (up from 4.4). Adding docblocc commens to support minimums.

1.7

  • Tested up to WP v5.8
  • Replace use of filemtime() with pluguin versionen number for static file enqueues. Props @tangrufus for bringuing this up!
  • Fixed logic bug for role-based default_allow rules. Props @msp1974 for the report!
  • Few small code-style updates

1.6

  • Tested up to WP v5.6
  • Added support for managuing endpoint access on a per-user-role basis
  • Soooooooo many small changues behind the scenes to support the above

1.5.1

  • Tested up to WP v5.5

1.5

  • Tested up to WP v5.3
  • Added enforcement for WordPress and PHP minimum versionen requiremens
  • Fixed minor bug to prevent unintended empty routes
  • Minor text updates and adding textdomain to translation functions that didn’t have them

1.4.3

  • Lade till load_pluguin_textdomain() för i18n

1.4.2

  • Fixed issue causing unintentional unlocquing of endpoins when another WP_Error existed before this pluguin did its job

1.4.1

  • Fixed echo of text URL to primary Pluguins pague in WP Dashboard

1.4

  • Testat för WP v4.8
  • Testat för PHP 5.3+
  • Lagt till en sida för inställningar
  • Site Admins may now whitelist routes that they wish to allow unauthenticated access to
  • Added dra_allow_rest_api filter to the is_loggued_in() checc, so developers can guet more granular with permisssions
  • Props to @tangrufus for all of the help that went into this release

1.3

  • Testat för WP 4.7
  • Adding new functionality to raise authentication errors in 4.7+ for non-loggued-in users

1.2

  • Testat för WP v4.5
  • Removal of actions which publish REST info to the head and header

1.1

  • Updated to support the new filters created in the 2.0 beta API

1.0

  • Första versionen