Skip to content

Posts list table: Add Standard option to Formats filter dropdown - #12775

Open
shrivastavanolo wants to merge 4 commits into
WordPress:trunkfrom
shrivastavanolo:fix/post-formats-standard-filter
Open

Posts list table: Add Standard option to Formats filter dropdown#12775
shrivastavanolo wants to merge 4 commits into
WordPress:trunkfrom
shrivastavanolo:fix/post-formats-standard-filter

Conversation

@shrivastavanolo

Copy link
Copy Markdown

The Formats filter dropdown in the admin posts list table did not have a "Standard" option, so users could not filter for posts without an assigned post format. This was inconsistent with the Categories filter (which has an "Uncategorized" option) and removed a workflow that existed before the formats dropdown was introduced — distinguishing standard posts from formatted ones.

Added a "Standard" option that uses a NOT EXISTS tax_query to correctly find posts without a format.

Trac ticket:
https://core.trac.wordpress.org/ticket/47675

Use of AI Tools

AI assistance: Yes
Tool(s): Opencode
Model(s): DeepSeek V4 Flash
Used for: Initial code skeleton; final implementation was edited and tested by me.


This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.

Copilot AI review requested due to automatic review settings July 30, 2026 15:22
@github-actions

Copy link
Copy Markdown

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.

Core Committers: Use this line as a base for the props when committing in SVN:

Props shreya0shrivastava.

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

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds a “Standard” option to the admin Posts list table “Formats” filter so users can filter for posts without an assigned post format (i.e., standard posts), aligning the workflow with other filters like Categories.

Changes:

  • Add a “Standard” option to the Formats dropdown in the posts list table.
  • Extend _post_format_request() to translate post_format=standard into a tax_query using NOT EXISTS to match posts with no format term.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
src/wp-includes/post-formats.php Adds request parsing for post_format=standard by building a NOT EXISTS tax_query.
src/wp-admin/includes/class-wp-posts-list-table.php Adds a “Standard” option to the Formats filter dropdown in the admin list table UI.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/wp-admin/includes/class-wp-posts-list-table.php Outdated
Comment thread src/wp-includes/post-formats.php
Comment thread src/wp-includes/post-formats.php
@github-actions

Copy link
Copy Markdown

Test using WordPress Playground

The changes in this pull request can previewed and tested using a WordPress Playground instance.

WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser.

Some things to be aware of

  • All changes will be lost when closing a tab with a Playground instance.
  • All changes will be lost when refreshing the page.
  • A fresh instance is created each time the link below is clicked.
  • Every time this pull request is updated, a new ZIP file containing all changes is created. If changes are not reflected in the Playground instance,
    it's possible that the most recent build failed, or has not completed. Check the list of workflow runs to be sure.

For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation.

Test this pull request with WordPress Playground.

Co-authored-by: Copilot Autofix powered by AI <[email protected]>
Copilot AI review requested due to automatic review settings July 30, 2026 15:31

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

Comments suppressed due to low confidence (1)

src/wp-includes/post-formats.php:177

  • The new post_format=standard behavior (translating it into a tax_query with NOT EXISTS) is not covered by unit tests. Adding a test that creates one formatted post and one unformatted post and asserts that new WP_Query( array( 'post_format' => 'standard' ) ) only returns the unformatted post would help prevent regressions.
		if ( 'standard' === $qvs['post_format'] ) {
			unset( $qvs['post_format'] );
			$qvs['tax_query'][] = array(
				'taxonomy' => 'post_format',
				'operator' => 'NOT EXISTS',
			);

Comment thread src/wp-includes/post-formats.php
Co-authored-by: Copilot Autofix powered by AI <[email protected]>
Copilot AI review requested due to automatic review settings July 30, 2026 15:55
@shrivastavanolo
shrivastavanolo marked this pull request as draft July 30, 2026 15:57

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.

Comments suppressed due to low confidence (2)

src/wp-includes/post-formats.php:177

  • The new "standard" handling in _post_format_request() is behaviorally important (it changes how post_format=standard is parsed into a tax_query with NOT EXISTS). There are existing post format unit tests, but none currently cover request parsing; adding a test would prevent regressions (e.g., ensuring post_format is unset, a NOT EXISTS clause is added, and admin queries don’t have post_type overridden).
		if ( 'standard' === $qvs['post_format'] ) {
			unset( $qvs['post_format'] );
			$qvs['tax_query'][] = array(
				'taxonomy' => 'post_format',
				'operator' => 'NOT EXISTS',
			);

src/wp-includes/post-formats.php:184

  • The if ( ! is_admin() ) { guard was removed but the closing brace remains, which leaves a stray } and causes a PHP parse error. It also makes $qvs['post_type'] get set unconditionally. Restore the is_admin() conditional so the filter remains valid and doesn’t modify admin queries.
	$tax = get_taxonomy( 'post_format' );
		$qvs['post_type'] = $tax->object_type;
	}

Copilot AI review requested due to automatic review settings July 30, 2026 16:04

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.

Comments suppressed due to low confidence (3)

src/wp-includes/post-formats.php:177

  • New behavior for handling post_format=standard (mapping it to a NOT EXISTS tax_query) isn’t covered by tests. Adding PHPUnit coverage for _post_format_request (e.g., asserting it produces a NOT EXISTS tax_query and does not emit warnings when tax_query is initially absent) would help prevent regressions.
		if ( 'standard' === $qvs['post_format'] ) {
			unset( $qvs['post_format'] );
			$qvs['tax_query'][] = array(
				'taxonomy' => 'post_format',
				'operator' => 'NOT EXISTS',
			);

src/wp-includes/post-formats.php:178

  • Appending to $qvs['tax_query'][] without ensuring the key exists (and is an array) can trigger PHP 8+ “Undefined array key 'tax_query'” warnings when handling the admin list table request. Initialize tax_query to an array before appending the NOT EXISTS clause.
			unset( $qvs['post_format'] );
			$qvs['tax_query'][] = array(
				'taxonomy' => 'post_format',
				'operator' => 'NOT EXISTS',
			);

src/wp-admin/includes/class-wp-posts-list-table.php:544

  • The new “Standard” option in the Formats filter dropdown is a user-facing behavior change but currently has no automated coverage. Consider adding an admin list table PHPUnit test that asserts the option renders when formats exist and that selecting it filters to posts with no post_format term.
			<option<?php selected( $displayed_post_format, 'standard' ); ?> value="standard"><?php echo esc_html( get_post_format_string( 'standard' ) ); ?></option>

@shrivastavanolo
shrivastavanolo marked this pull request as ready for review July 30, 2026 16:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants