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

Add applyFilters to the Query Block query. #34201

Closed
Tracked by #41405
TobyOsborne opened this issue Aug 20, 2021 · 1 comment
Closed
Tracked by #41405

Add applyFilters to the Query Block query. #34201

TobyOsborne opened this issue Aug 20, 2021 · 1 comment
Labels
[Block] Query Loop Affects the Query Loop Block [Feature] Extensibility The ability to extend blocks or the editing experience

Comments

@TobyOsborne
Copy link

TobyOsborne commented Aug 20, 2021

What problem does this address?

Currently, there doesn't seem to be a way to modify the Query Block query (for the preview in the block editor).

For example, I'd like to create a custom attribute that modifies the query to show different items.

On the frontend this is easily done through pre_get_posts, but I'm having a hard time reflecting it in the block editors preview.

What is your proposed solution?

Add anapplyFilters somewhere that provides access to the Query block attributes, and allows modifying the query variable set in the post-template block (around line 89)

@ntsekouras
Copy link
Contributor

Thanks for the issue @TobyOsborne !

I believe this issue is resolved by a set of PRs(ex 1, 2).

You can read more about extending Query Loop block and if feel free to reopen the issue if you need something different.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Query Loop Affects the Query Loop Block [Feature] Extensibility The ability to extend blocks or the editing experience
Projects
None yet
Development

No branches or pull requests

3 participants