From 27f695178a8d8257138fde6af0e478b442f91141 Mon Sep 17 00:00:00 2001 From: Jorge Costa Date: Fri, 27 Dec 2024 17:44:00 +0000 Subject: [PATCH] add permision check on getPostsPageId --- packages/core-data/src/private-selectors.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/packages/core-data/src/private-selectors.ts b/packages/core-data/src/private-selectors.ts index 5b650b60618b85..fb0401509694ef 100644 --- a/packages/core-data/src/private-selectors.ts +++ b/packages/core-data/src/private-selectors.ts @@ -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;