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

Editor backfill query is hardcoded to posts #54

Open
dlh01 opened this issue Sep 14, 2023 · 6 comments
Open

Editor backfill query is hardcoded to posts #54

dlh01 opened this issue Sep 14, 2023 · 6 comments
Assignees
Labels
enhancement New feature or request gutenberg Requires understanding Gutenberg typescript Requires understanding TypeScript

Comments

@dlh01
Copy link
Member

dlh01 commented Sep 14, 2023

Description of the bug

No matter the post types selected for the block, the wp/v2/posts/ endpoint is used for searching, which returns only posts.

Steps To Reproduce

  1. Add page to the wp_curate_duduplication_slotfill_post_types filter.
  2. Update the query block to draw backfill from only pages.
  3. See posts display in the backfill instead of pages.

Additional Information

See here:

'/wp/v2/posts',
.

Acceptance Criteria

@dlh01 dlh01 added the bug Something isn't working label Sep 14, 2023
@mogmarsh
Copy link
Collaborator

we probably need to create a custom endpoint or use /wp/v2/search

@mogmarsh
Copy link
Collaborator

ah yes, we had this fixed in the "first attempt": https://github.com/alleyinteractive/wp-curate/blob/first-attempt/src/class-wp-curate.php#L21-L35

@mogmarsh
Copy link
Collaborator

update: this is fixed, but I don't know if it was fixed in the best way.

@kevinfodness kevinfodness added gutenberg Requires understanding Gutenberg typescript Requires understanding TypeScript labels Nov 21, 2023
@kevinfodness kevinfodness added enhancement New feature or request and removed bug Something isn't working labels Jan 10, 2024
@jacobschweitzer jacobschweitzer self-assigned this Nov 1, 2024
@jacobschweitzer
Copy link

Working on re-factoring to use the /search endpoint.

@mogmarsh
Copy link
Collaborator

mogmarsh commented Nov 4, 2024

@jacobschweitzer I don't think /search will work, because we're using the core Post Template block, which references a post type endpoint. See https://github.com/WordPress/gutenberg/blob/trunk/packages/block-library/src/post-template/edit.js#L210
I think we decided the best fix is to create a dummy custom post type called wp-curate so that /wp/v2/wp-curate works and have it return posts from all the selected post types, rather than modifying the behavior of `wp/v2/posts/

@jacobschweitzer
Copy link

@mogmarsh I got a PR started though it needs a bit more work to get it across the finish line. I'm uncertain if this will be used in the project I'm on so I need to shift my focus back to other things for the time being.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request gutenberg Requires understanding Gutenberg typescript Requires understanding TypeScript
Projects
None yet
Development

No branches or pull requests

4 participants