-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Convert AJAX endpoints to REST API routes #36
Labels
cleanup
Improves code organization and usability
enhancement
Existing feature enhancements
performance
Changes related to performance optimization
security
Security vulnerability or tightening
Comments
MichelleBlanchette
changed the title
Need AJAX endpoint to give object title by ID
Need REST endpoint to give object title by ID
Aug 22, 2020
Just went with an AJAX endpoint for now to get release out faster in commit 0fe5c60 |
MichelleBlanchette
added
enhancement
Existing feature enhancements
and removed
bug
Something isn't working
labels
Nov 1, 2020
MichelleBlanchette
changed the title
Need REST endpoint to give object title by ID
Convert AJAX calls to Rest_Routes
Nov 1, 2020
The AJAX endpoint works great, so there's no need to change it. Let's definitely get all AJAX usage switched over to REST API endpoints, though. They are more efficient and accessible. 👍 |
MichelleBlanchette
changed the title
Convert AJAX calls to Rest_Routes
Convert AJAX endpoints to REST API routes
Nov 1, 2020
MichelleBlanchette
added
cleanup
Improves code organization and usability
performance
Changes related to performance optimization
security
Security vulnerability or tightening
labels
Oct 13, 2023
MichelleBlanchette
added a commit
that referenced
this issue
Nov 8, 2023
Issues/36 – Convert WP Admin AJAX actions to REST API endpoints
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
cleanup
Improves code organization and usability
enhancement
Existing feature enhancements
performance
Changes related to performance optimization
security
Security vulnerability or tightening
There seems to be no way to retrieve an object's title by just having the ID, like you can in PHP with the generic
get_post( $id )
call. With the REST API v2, you must already know the post_type of the object, which is obviously no good when you only have the object ID. So we gotta make our own endpoint!And since I want to convert all AJAX endpoints to REST routes, anyways, you might as well go ahead and make our
Rest_Routes
class so we can easily migrate everything in a future release. 🚀 Be sure to segment Asana routes from generic, WordPress routes such as this.I discovered this bug by saving a Page object ID to the automations Pin Post field which uses the
/wp/v2/posts/{id}
endpoint to load the title label for the initial value. Turns out this endpoint is for literally posts... And with custom post types, this just becomes a disaster—especially because custom post types do not automatically have routes set because some are private (only used internally/programmatically), so keep this in mind when displaying search results!!! It can easily get super messy! And then just add a filter if people want to allow private/hidden post types in search results. 👍The text was updated successfully, but these errors were encountered: