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

Query block: Conflict with excerpt_more filter #32473

Closed
dashkevych opened this issue Jun 5, 2021 · 3 comments · Fixed by #33366
Closed

Query block: Conflict with excerpt_more filter #32473

dashkevych opened this issue Jun 5, 2021 · 3 comments · Fixed by #33366
Assignees
Labels
[Block] Post Excerpt Affects the Post Excerpt Block [Package] Block library /packages/block-library [Status] In Progress Tracking issues with work in progress [Type] Bug An existing feature does not function as intended

Comments

@dashkevych
Copy link

Description

It looks like the Query block outputs multiple More links when the Post Excerpt block is used within the Query block , and excerpt_more filter is used in the theme functions.

Step-by-step reproduction instructions

  1. Create new page.
  2. Add the Query block to the content area (Grid View, and 3 columns layout to display 3 latest posts).
  3. Select the Post Excerpt block.
  4. In the Post Excerpt settings, set "Max words" to 25 and check option "Show link on new line".
  5. Add "read more" link text.
  6. Publish page.

Expected behaviour

Only one More link should be shown in the excerpt section.

Actual behaviour

The excerpt section displays two More links: one from the theme, added via excerpt_more filter, and another from the Query block, with a custom text added using the Editor.

Multiple more links in the excerpt section

WordPress information

  • WordPress version: "5.8-alpha-51064"
  • Gutenberg version: Not installed
  • Twenty Twenty-One: "1.3"
  • Are all plugins deactivated? "Yes"
@ntsekouras ntsekouras added [Block] Post Excerpt Affects the Post Excerpt Block [Block] Query Loop Affects the Query Loop Block Needs Testing Needs further testing to be confirmed. labels Jun 7, 2021
@dashkevych
Copy link
Author

Additionally, I've noticed that if the Read More link is wrapped within p tag and added using the excerpt_more filter, the block creates additional empty p tag:

Query block issue with more links

@ntsekouras ntsekouras added [Package] Block library /packages/block-library [Type] Bug An existing feature does not function as intended and removed Needs Testing Needs further testing to be confirmed. [Block] Query Loop Affects the Query Loop Block labels Jul 12, 2021
@github-actions github-actions bot added the [Status] In Progress Tracking issues with work in progress label Jul 12, 2021
@dashkevych
Copy link
Author

It seems like this issue has not been fixed. It still shows two links in the Editor:

Excerpt issue

I've tested it in WordPress 5.8 with Twenty Twenty-One (Version: 1.4)

@ntsekouras
Copy link
Contributor

It seems like this issue has not been fixed. It still shows two links in the Editor:

Currently PostExcerpt block does show the rendered output in the editor, but if the theme uses excerpt_more filter, it's removed in the front-end. You can read the PR's description with these changes, where I explain some challenges to make this block consistent.

It will need more thinking and explorations in the future to make this as consistent as possible, but all the applied filters which some are conditional, makes it a tough problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Post Excerpt Affects the Post Excerpt Block [Package] Block library /packages/block-library [Status] In Progress Tracking issues with work in progress [Type] Bug An existing feature does not function as intended
Projects
None yet
2 participants