From 2dd71206637f025d15042515e98be67a9bc3619c Mon Sep 17 00:00:00 2001 From: Jorge Costa Date: Tue, 29 Jan 2019 10:26:39 +0000 Subject: [PATCH] Fix: Hide empty categories in categories block. (#13549) This commit uses hide_empty option during categories request to make sure categories that have no posts are not displayed in the categories block edit view. On the frontend, they are not rendered so the edit view should replicate that. Some categories may still show zero as a count. That happens because these categories have descendant categories with posts associated to them. --- packages/block-library/src/categories/edit.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/block-library/src/categories/edit.js b/packages/block-library/src/categories/edit.js index 5341ad6ff5168..ad1dea3ec55bf 100644 --- a/packages/block-library/src/categories/edit.js +++ b/packages/block-library/src/categories/edit.js @@ -201,7 +201,7 @@ export default compose( withSelect( ( select ) => { const { getEntityRecords } = select( 'core' ); const { isResolving } = select( 'core/data' ); - const query = { per_page: -1 }; + const query = { per_page: -1, hide_empty: true }; return { categories: getEntityRecords( 'taxonomy', 'category', query ),