gutenberg icon indicating copy to clipboard operation
gutenberg copied to clipboard

Query Loop: tag filtering limited to 100 tags

Open hellofromtonya opened this issue 5 years ago • 13 comments

Description

First reported in Core Trac ticket 53704.

When there are more than 100 tags (in the above report there are 300 tags), only 100 tags are available for filtering the Query Loop.

Step-by-step reproduction instructions

  1. Using wp-cli create at least 200 tags (these will be created as Tag 1 to Tag NNN)
  2. Create a post
  3. Add a Query Loop block and select the first template
  4. Go to the Tags field in the block's Filters
  5. Type Tag 100 => Notice it does appears and is selectable as the filter
  6. Type Tag 200 => Notice it does not appear and is not selectable as the filter

Expected behaviour

The tag field's auto complete should fetch the next group of tags that match what has been typed into the field. In other words, it should display these tags and allow them to be selectable.

Actual behaviour

Tags named as Tag 1 to Tag 302.

  • When typing Tag 1, the field displayed Tags 1 to Tags 189. It did not display Tag 190+.
  • When typing Tag 2, nothing showed in the field and pressing enter for manually input it did not work (reset the field to empty).
  • When typing Tag 302, nothing showed in the field and pressing enter for manually input it did not work (reset the field to empty).

Note: No errors in browser console.

Screenshots or screen recording (optional)

53704-reproduced

and video provided by reporter https://youtu.be/lKlYlMZ6Mx0

WordPress information

  • WordPress version: 5.8
  • Gutenberg version: NA
  • Are all plugins except Gutenberg deactivated? Yes AND Gutenberg plugin is also deactivated
  • Are you using a default theme (e.g. Twenty Twenty-One)? Yes

Device information

  • Device: Desktop
  • Operating system: macOS Big Sur v 11.4
  • Browser: Chrome v 91.0.4472.114

hellofromtonya avatar Jul 20 '21 21:07 hellofromtonya

Any update on this?

kev-mas avatar Oct 15 '21 19:10 kev-mas

Will this be fixed before block themes are released in January? I have been trying to use the Query Loop block to update pages; I wanted to remove some custom solutions and use the built-in Gutenberg tools, but I immediately ran into this problem. Filtering a query by a tag seems like a common scenario, and right now it does not work on a medium-sized site.

JoshuaLindquist avatar Dec 08 '21 07:12 JoshuaLindquist

I had to manually add the tag ID using the code view of the editor. I'm also waiting for this fix.

JosVelasco avatar Jan 13 '22 04:01 JosVelasco

Will this be fixed before block themes are released in January? I have been trying to use the Query Loop block to update pages; I wanted to remove some custom solutions and use the built-in Gutenberg tools, but I immediately ran into this problem. Filtering a query by a tag seems like a common scenario, and right now it does not work on a medium-sized site.

We are currently in a similar scenario. Is there any new development as concerns this issue?

MuluhGodson avatar Feb 17 '22 21:02 MuluhGodson

For clarity, we have 3,527 tags, so the 100 tag limit is far from ideal.

brylie avatar Feb 18 '22 07:02 brylie

For anyone needing a workaround, here is how to manually add the tag ID, as @JosVelasco mentioned:

  1. get the desired tag ID by visiting the Tags page and hovering over the tag (the ID will be in the URL after tag_ID=)
  2. click the vertical ellipsis in the upper right hand corner of the edit screen
  3. click "code editor"
  4. look for the query and add the tag ID to the tagIds array

image

image

brylie avatar Feb 18 '22 07:02 brylie

Why is it so hard to solve this problem? It is a painfull process to clarify the situation to my customer and educate them to code - they do not want to code, that's why they use WordPress...

SkylerMax avatar Aug 05 '22 17:08 SkylerMax

Wondering if there is a solution to this problem as well. Mad props to @JosVelasco for the workaround. If there is no one working on resolving this right now, can you clarify if you are open to pull requests to dix the problem?

hamannjames avatar Sep 30 '22 20:09 hamannjames

I'm experiencing this issue too.

I initially thought it has something to do with my theme or plugin, but my developer informed me that the issue was on WordPress and that I should contact WordPress support. Fortunately, it's a general issue. Surprisingly, it's still not fixed after being identified in 2021.

Hopefully, the issue gets fixed in the near future as the Post List block is a very useful feature I use on my projects and clients' projects. I had been using Category and Keyword filters as a workaround, but that approach is not sufficient.

Big shout out to @JosVelasco and @brylie for a better workaround!

sandandkush avatar Oct 01 '22 20:10 sandandkush

This task is open for more than 12 months? I am glad I found this issue. I thought it was a bug with my content.

mtoensing avatar Nov 07 '22 21:11 mtoensing

Gotta add a "ditto"on this one. Stumbled across this bug the hard way after spending hours removing another plugin that helped me generate lists of posts that have a tag. Now I'm stuck, unable to go froward while not thrilled about going back to the old way.

ghost avatar Dec 10 '22 17:12 ghost

I also came across this error. I want to fix it. I've started to create a Pull Request and I see that the 100 tag list is fetched when rendering the component. When typing the tag name, nothing new is fetched, it is all the time filtering the previously fetched list of tags. https://github.com/WordPress/gutenberg/blob/b856a3fc6b72b3c48f35608c68b83d0953959f47/packages/block-library/src/query/edit/inspector-controls/taxonomy-controls.js#L38-L50 https://github.com/WordPress/gutenberg/blob/b856a3fc6b72b3c48f35608c68b83d0953959f47/packages/block-library/src/query/edit/inspector-controls/taxonomy-controls.js#L84-L121

I see that there is a FlatTermSelector component in Gutenberg. I think it is worth using it instead of re-creating the same functionality in several places. It would be nice if this component was available for reuse. https://github.com/WordPress/gutenberg/blob/b856a3fc6b72b3c48f35608c68b83d0953959f47/packages/editor/src/components/post-taxonomies/flat-term-selector.js Currently, it cannot be used.

rafaucau avatar Dec 15 '22 01:12 rafaucau

Hey 👋 - I'd appreciate some testing in this PR that aims to resolve this issue. Thanks!

ntsekouras avatar Dec 19 '22 12:12 ntsekouras