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

Backport from WordPress core: Improvements for the post format query loop filter #66037

Merged
merged 1 commit into from
Oct 30, 2024

Conversation

carolinan
Copy link
Contributor

What? Why? How?

This pull request copies changes that were made in WordPress core in WordPress/wordpress-develop#7314 The pull request that added the PHP changes related to #64167

  • Improved logic for the use of the AND relation key when a user queries for both a format and a taxonomy.
  • Improved inline documentation, for clarity and readability.
  • Improved validation of the queried formats against the registered formats.
  • Misc: renaming of variables for better readability.

Testing Instructions

Confirm that there are no issues and no functional changes when using the post format filter with and without the plugin active, using WordPress 6.7 Beta.

To test the functionality:

Enable post formats in a theme by adding the theme support. Example:

function twentytwentyfour_setup(){
	add_theme_support( 'post-formats', array( 'standard', 'aside', 'gallery', 'audio', 'video', 'link', 'image', 'chat', 'status', 'quote' ) );
}

add_action( 'after_setup_theme', 'twentytwentyfour_setup' )

Create a new category.
Create a new post with a post format and assign it to the category.
Create a second post with the same post format, without the category.

Select or insert a query loop block.
In the settings sidebar for the query loop, select "custom".
Locate and open the Filter panel.
Enable the format filter, and enter the name of the format you assigned to your posts.
Save
Confirm that the two posts are showing in the query loop in the editor and front.
Go back to the filter panel and enable the taxonomy filter.
Insert the category you assigned to one of the posts.
Confirm that only the post that has both the category and the format shows in the query loop in the editor and front.

…oop filter

This pull request copies changes that were made in WordPress core in WordPress/wordpress-develop#7314: The pull request that added the PHP changes related to #64167.

- Improved logic for the use of the `AND`  `relation` key when a user queries for both a format and a taxonomy.
- Improved inline documentation, for clarity and readability.
- Improved validation of the queried formats against the registered formats.
- Misc: renaming of variables for better readability.
@carolinan carolinan added the Backport from WordPress Core Pull request that needs to be backported to a Gutenberg release from WordPress Core label Oct 11, 2024
@carolinan carolinan marked this pull request as ready for review October 11, 2024 10:56
Copy link

github-actions bot commented Oct 11, 2024

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: carolinan <[email protected]>
Co-authored-by: Mamaduka <[email protected]>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@Mamaduka Mamaduka added REST API Interaction Related to REST API [Block] Query Loop Affects the Query Loop Block labels Oct 30, 2024
@carolinan
Copy link
Contributor Author

Thank you for the review.

@carolinan carolinan merged commit b95553f into trunk Oct 30, 2024
78 of 79 checks passed
@carolinan carolinan deleted the update/from-post-format-filter-backport branch October 30, 2024 11:00
@github-actions github-actions bot added this to the Gutenberg 19.6 milestone Oct 30, 2024
@cbravobernal cbravobernal added the [Type] Enhancement A suggestion for improvement. label Oct 30, 2024
Copy link

Warning: Type of PR label mismatch

To merge this PR, it requires exactly 1 label indicating the type of PR. Other labels are optional and not being checked here.

  • Type-related labels to choose from: [Type] Automated Testing, [Type] Breaking Change, [Type] Bug, [Type] Build Tooling, [Type] Code Quality, [Type] Copy, [Type] Developer Documentation, [Type] Enhancement, [Type] Experimental, [Type] Feature, [Type] New API, [Type] Task, [Type] Technical Prototype, [Type] Performance, [Type] Project Management, [Type] Regression, [Type] Security, [Type] WP Core Ticket, Backport from WordPress Core, Gutenberg Plugin.
  • Labels found: [Type] Enhancement, REST API Interaction, [Block] Query Loop, Backport from WordPress Core.

Read more about Type labels in Gutenberg. Don't worry if you don't have the required permissions to add labels; the PR reviewer should be able to help with the task.

karthick-murugan pushed a commit to karthick-murugan/gutenberg that referenced this pull request Nov 13, 2024
…oop filter (WordPress#66037)

This pull request copies changes that were made in WordPress core in WordPress/wordpress-develop#7314: The pull request that added the PHP changes related to WordPress#64167.

- Improved logic for the use of the `AND`  `relation` key when a user queries for both a format and a taxonomy.
- Improved inline documentation, for clarity and readability.
- Improved validation of the queried formats against the registered formats.
- Misc: renaming of variables for better readability.


Co-authored-by: carolinan <[email protected]>
Co-authored-by: Mamaduka <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Backport from WordPress Core Pull request that needs to be backported to a Gutenberg release from WordPress Core [Block] Query Loop Affects the Query Loop Block REST API Interaction Related to REST API [Type] Enhancement A suggestion for improvement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants