Closed mipon closed 2 years ago
@mipon You should be able to achieve that by passing only the current user's posts to PostControl
like this:
const postType = "post";
const { id: authorId } = useSelect((select) => {
return select("core").getCurrentUser();
}, []);
const myPosts = useSelect(
(select) =>
select("core").getEntityRecords("postType", postType, {
per_page: -1,
orderby: "title",
order: "asc",
status: "publish",
author: authorId,
}),
[postType, authorId]
);
You can then simply pass myPosts
to the current PostControl
component and it should work. Note that if using a custom post type, you need to add author
to the supports
array when registering it.
I'll see about adding possibility to pass additional query arguments to our useAllPosts
hook, so you could easily pass along the author id etc.
Great, thank you.
Hi,
Nice work.
Is it possible to limit the post list options of
PostControl
to posts created by the currently editing user?