diff --git a/packages/block-library/src/page-list/edit.js b/packages/block-library/src/page-list/edit.js index 2311308c41b165..5328689edcbbe2 100644 --- a/packages/block-library/src/page-list/edit.js +++ b/packages/block-library/src/page-list/edit.js @@ -154,6 +154,9 @@ export default function PageListEdit( { ( + { __( 'Page List: No pages to show.' ) } + ) } /> diff --git a/packages/block-library/src/page-list/index.php b/packages/block-library/src/page-list/index.php index 6f99ab14c95ef3..dc1a654d757a07 100644 --- a/packages/block-library/src/page-list/index.php +++ b/packages/block-library/src/page-list/index.php @@ -250,6 +250,12 @@ function render_block_core_page_list( $attributes, $content, $block ) { ) ); + // If thare are no pages, there is nothing to show. + // Return early and empty to trigger EmptyResponsePlaceholder. + if ( empty( $all_pages ) ) { + return; + } + $top_level_pages = array(); $pages_with_children = array();