Skip to content

Commit

Permalink
Fix: Hide empty categories in categories block. (#13549)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
jorgefilipecosta committed Jan 29, 2019
1 parent 5bdc8c6 commit a13d933
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/block-library/src/categories/edit.js
Expand Up @@ -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 ),
Expand Down

0 comments on commit a13d933

Please sign in to comment.