PHP

How to Disable WP JSON Rest API in WordPress without plugin ?

just add below code in wordpress theme function.php file at the bottom

--------------------------------------------------
Add the following code to functions.php (anyone)
--------------------------------------------------


if( ! is_user_logged_in() ) {
remove_action('rest_api_init', 'create_initial_rest_routes', 99);
}


-----------------------------------
OR
-----------------------------------


remove_action('rest_api_init', 'create_initial_rest_routes', 99);

------------------------------------------
Check if your site's username is exposed
------------------------------------------
website-URL.com/wp-json/wp/v1/users
website-URL.com/wp-json/wp/v2/users
website-URL.com/wp-json/
remove_action('rest_api_init','create_initial_rest_routes',99);
Basant

Recent Posts

Laravel Development Company in India | Custom Laravel Web Development Services

Laravel has become one of the most popular PHP frameworks because it enables developers to…

3 months ago

Git Commands Cheat Sheet: 15 Essential Git Commands Every Developer Must Know (Beginner to Advanced Guide)

Git Commands Cheat Sheet: 15 Essential Git Commands Every Developer Must Know Git is one…

7 months ago

How to make dependent dropdown of state and district using cakephp2 form?

Creating dependent dropdowns in CakePHP 2 involves using AJAX to dynamically load data into the…

2 years ago