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

Open
wants to merge 1 commit into
base: trunk
Choose a base branch
from

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

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 <poena@git.wordpress.org>

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

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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant