Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Categories block: content can differ between editor and front-end #37319

Open
chthonic-ds opened this issue Dec 13, 2021 · 2 comments
Open

Categories block: content can differ between editor and front-end #37319

chthonic-ds opened this issue Dec 13, 2021 · 2 comments
Assignees
Labels
[Block] Categories Affects the Categories Block [Type] Bug An existing feature does not function as intended [Type] WP Core Ticket Requires an upstream change from WordPress. Core Trac ticket should be linked.

Comments

@chthonic-ds
Copy link
Contributor

Description

A Categories block can be configured to unintentionally display different content for the editor view and front-end view.

Step-by-step reproduction instructions

The reproduction steps here use the following set-up:

  • Parent category: Collection
  • Child categories of Collection: Bat, Cat, Hat

Collection should not be assigned to a post, while each child category should be assigned to at least one post each.

  1. Create a new post and add a Categories block. The Categories settings panel should show all settings as inactive.
  2. Publish the post and observe the empty parent category is displayed in the editor view and omitted from the front-end view.
  3. Add another Categories block and enable settings: Show post counts and Show hierarchy.
  4. Update the post and observe the parent category displays a count of 0 in the editor view and the sum of the child counts in the front-end view.

Screenshots, screen recording, code snippet

Category structure
image

Editor view
image

Front-end view
image

Environment info

WP 5.9 beta2, Gutenberg active or inactive, Twenty Twenty-Two
Chrome 96.0.4664.45
Windows 10

Please confirm that you have searched existing issues in the repo.

Yes

Please confirm that you have tested with all plugins deactivated except Gutenberg.

Yes

@Mamaduka Mamaduka added the [Block] Categories Affects the Categories Block label Dec 14, 2021
@t-hamano t-hamano added the [Type] Bug An existing feature does not function as intended label Oct 22, 2022
@t-hamano t-hamano self-assigned this Oct 22, 2022
@t-hamano
Copy link
Contributor

Thank you for submitting the issue and I apologize for the delay in replying.

I was able to reproduce it with the latest gutenberg. When the output was compared to the category block of the classic widget, it matched the output of the front end, so it must be the editor's output that is wrong. I would like to investigate the code on the editor side.

Test Result

Add child categories:

categories

Tie categories to posts:

post-list

The editor view:

editor view

The front-end view

front-end view

@t-hamano
Copy link
Contributor

Upon further investigation, I found that the number of front-end cases in the first place may not be correct for some conditions.
Below is the ticket I submitted to the core:
https://core.trac.wordpress.org/ticket/56892

@skorasaurus skorasaurus added the [Type] WP Core Ticket Requires an upstream change from WordPress. Core Trac ticket should be linked. label Mar 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Categories Affects the Categories Block [Type] Bug An existing feature does not function as intended [Type] WP Core Ticket Requires an upstream change from WordPress. Core Trac ticket should be linked.
Projects
None yet
Development

No branches or pull requests

4 participants