Description
Hi,
I'm using WordPress JavaScript packages to get current user infos from a custom settings page with the code below.
All scripts are loaded with the right dependencies and settings by default.
For example wp-api-fetch :

Issue identified :
The sent request to the REST API does'nt contain the Root URL mentioned in those settings.

Image shows the request sent to the Settings API but I have the same error with User API, it uses care.local/wp/… instead of care.local/wp-json/wp/… at the Root URL level.
Any idea where this problem comes from ?
Step-by-step reproduction instructions
Example of code to get Current User infos :
import { store as coreStore } from "@wordpress/core-data";
import { useSelect } from "@wordpress/data";
function MySettingsPage() {
const currentUser = useSelect( ( select ) => select( coreStore ).getCurrentUser(), [] );
console.log( { currentUser } );
return ( <p>Example page</p> );
}
export default MySettingsPage;
Screenshots, screen recording, code snippet
No response
Environment info
No response
Please confirm that you have searched existing issues in the repo.
Yes
Please confirm that you have tested with all plugins deactivated except Gutenberg.
Yes
Description
Hi,
I'm using WordPress JavaScript packages to get current user infos from a custom settings page with the code below.
All scripts are loaded with the right dependencies and settings by default.
For example
wp-api-fetch:Issue identified :
The sent request to the REST API does'nt contain the Root URL mentioned in those settings.
Image shows the request sent to the Settings API but I have the same error with User API, it uses
care.local/wp/…instead ofcare.local/wp-json/wp/…at the Root URL level.Any idea where this problem comes from ?
Step-by-step reproduction instructions
Example of code to get Current User infos :
Screenshots, screen recording, code snippet
No response
Environment info
No response
Please confirm that you have searched existing issues in the repo.
Yes
Please confirm that you have tested with all plugins deactivated except Gutenberg.
Yes