Timeline for How to get custom user meta by id in custom Gutenberg block
Current License: CC BY-SA 4.0
7 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Jul 18, 2023 at 9:42 | comment | added | Lovor | And entities.js is not in WordPress instalation, because you have compiled Gutenberg code. You should look instead in Gutenberg repository on github. | |
Jul 18, 2023 at 9:40 | comment | added | Lovor | Also @Kropotkin, getCurrentUser() might be selector you need, it is the user who is currently editing post, and that user will be saved as author upon saving of the post. | |
Jul 18, 2023 at 9:35 | comment | added | Lovor | If there is REST endpoint which gives ID for author of current post, you can get it, at least by using getEntityRecords or some more specialized selector. If such endpoint does not exist already, you should create it. | |
Jul 17, 2023 at 9:01 | comment | added | Kropotkin | I wonder how you would get the user id of the current post? - FI - the above line wp.data.select('core').getUser(1,{'_fields':'first_name,last_name'}) errors for me. (No file entities.js in my install of WordPress 6.2.2) | |
Jan 23, 2023 at 11:56 | comment | added | Shoelaced |
Amazing, thanks, I wish the documentation on all this would get completed! I'm not sure if it matters but I've switched my implementation from getEntityRecords to getUsers and it works, so thanks for that. I'm working with custom meta which I still had to add to REST and all that, but this definitely helped.
|
|
Jan 23, 2023 at 1:40 | history | edited | Lovor | CC BY-SA 4.0 |
deleted 1 character in body
|
Jan 23, 2023 at 1:27 | history | answered | Lovor | CC BY-SA 4.0 |