[API] Nghiên cứu về class WP_REST_Posts_Controller (ok)

1.public function get_items

Mặc định api http://localhost/wordpress/wp-json/wp/v2/posts chỉ lấy "type": "post"

Do đó nếu muốn lấy "type": "book" chẳng hạn :)

C:\xampp\htdocs\wordpress\wp-includes\rest-api\endpoints\class-wp-rest-posts-controller.php public function get_items thay đổi thành :))

Đăng ký book ;)

C:\xampp\htdocs\wordpress\wp-content\themes\gutener\functions.php

Và kết quả như mong đợi :)

2. get_collection_params

C:\xampp\htdocs\wordpress\wp-includes\rest-api\endpoints\class-wp-rest-controller.php

C:\xampp\htdocs\wordpress\wp-includes\rest-api\endpoints\class-wp-rest-posts-controller.php

Last updated

Was this helpful?