Recognize logged WP user in existing REST API

Question

I have a plugin using pre_get_post filter to hide posts depending on which user is logged. However the “parent page” selector in the WP “edit post” page uses a wp-json call to get existing pages.

This creates a big problem: logged user is not recognized and restricted posts are always hidden.

Is there a way to hook into those REST API calls (eg. wp-json/wp/v2/pages?context=edit) and pass the user nonce or any way to recognize the user?

I read a lot about the X-WP-Nonce parameter, but I’m not creating a new REST call. I need to hook in existing ones.

0
a-coder 1 month 2023-01-07T05:46:49-05:00 0 Answers 0 views 0

Leave an answer

Browse
Browse