Skip to content

Commit

Permalink
add permision check on getPostsPageId
Browse files Browse the repository at this point in the history
  • Loading branch information
jorgefilipecosta committed Dec 27, 2024
1 parent f7d93f5 commit 27f6951
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions packages/core-data/src/private-selectors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,13 @@ export const getHomePage = createRegistrySelector( ( select ) =>
);

export const getPostsPageId = createRegistrySelector( ( select ) => () => {
const canReadSiteData = select( STORE_NAME ).canUser( 'read', {
kind: 'root',
name: 'site',
} );
if ( ! canReadSiteData ) {
return null;
}
const siteData = select( STORE_NAME ).getEntityRecord( 'root', 'site' ) as
| SiteData
| undefined;
Expand Down

0 comments on commit 27f6951

Please sign in to comment.