I need to disable API logins. How do I do this and how can I verify that the blocking is working?
Hi
I'm using WordPress 6.4.3 and need to disable API logins because I'm getting many failed login attempts even though I've limited access to /wp-admin/ to specific IP addresses in htaccess.
I haven't created Application Passwords.
I have the Disable WP REST API plugin enabled.
When I go to my-website/wp-json/wp/v2/users using Google chrome, I get the message:
"{"code":"rest_login_required","message":"REST API restricted to authenticated users.","data":{"status":401}}"
I have the Limit Login Attemps plugin installed.
I tried sending a request from Step 3:
(with random login/password data)
I get a 401 status, but the Limit Login Attempts check doesn't increment the failed login attempt counter.
Do you have a Python script I can use to check if the API login is not working?
I'm trying this code
import wordpress
site_url = "MY_URL"
username = "user1"
password = "your_application_password"
wp = wordpress.Connect(site_url, username, password)
print(wp)
I get this answer
> & "C:\Program Files\Python314\python.exe" c:/MyStuff/Python/wordpress/r2.py
2026-08-06 17:52:55,123 - ERROR - Authentication failed: {"code":"rest_login_required","message":"REST API restricted to authenticated users.","data":{"status":401}}
Traceback (most recent call last):
File "c:\MyStuff\Python\wordpress\r2.py", line 6, in <module>
wp = wordpress.Connect(site_url, username, password)
File "C:\Users\Adam\AppData\Roaming\Python\Python314\site-packages\wordpress\wordpress.py", line 140, in __init__
raise Exception("Authentication failed")
Exception: Authentication failed
PS C:\Program Files\Microsoft VS Code> ^C
PS C:\Program Files\Microsoft VS Code>
[link] [comments]