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 authored and youknowriad committed Mar 6, 2019
1 parent db81de4 commit 0c3f57d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/block-library/src/categories/edit.js
Original file line number Diff line number Diff line change
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 0c3f57d

Please sign in to comment.