Skip to content

feat(bulk-editor): supply post images through a filter - #23557

Open
thijsoo wants to merge 1 commit into
feature/ai-alt-text-image-productfrom
1396-woo-seo---create-bulk-editor-integration-that-supplies-the-bulk-editor-with-woo-specifics
Open

feat(bulk-editor): supply post images through a filter#23557
thijsoo wants to merge 1 commit into
feature/ai-alt-text-image-productfrom
1396-woo-seo---create-bulk-editor-integration-that-supplies-the-bulk-editor-with-woo-specifics

Conversation

@thijsoo

@thijsoo thijsoo commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

Context

  • The bulk editor table needs to show images for the content it lists, but Yoast SEO Free has no images of its own to show — a product image and its variations are Woo-specific knowledge that lives in Woo SEO.
  • This PR adds the extension point Free is missing: an images field on the bulk editor post, filled through a new filter, so an add-on can supply the images per post without Free knowing anything about products.
  • Free itself supplies nothing, so this changes no behaviour on its own; it is the groundwork the Woo SEO bulk editor integration hooks into.

Summary

This PR can be summarized in the following changelog entry:

  • Adds an internal filter that lets add-ons supply the images shown for a post in the bulk editor.

Relevant technical choices:

Test instructions

Test instructions for the acceptance test before the PR gets merged

This PR can be acceptance tested by following these steps:

  • Check out this branch and make sure Yoast SEO is active.
  • Go to Yoast SEO → Bulk editor and confirm the table still loads, lists your posts, and that searching, filtering by content type and paging all still work exactly as before. Nothing visible should have changed.
  • Open a post from the table with the Edit link and confirm it still opens the right post.
  • To confirm the new extension point actually works, add this snippet to a plugin or to your theme's functions.php, then reload the bulk editor and check the browser's network tab: the posts response should carry an images value of {"thumbnail": "test"} for every row.
add_filter(
	'wpseo_bulk_editor_post_images',
	static function ( $images, $post_id, $content_type ) {
		return [ 'thumbnail' => 'test' ];
	},
	10,
	3
);
  • Repeat the previous step with the indexables switched off, so the fallback collector is used, and confirm the images value is still present. Indexables can be disabled by adding add_filter( 'Yoast\WP\SEO\should_index_indexables', '__return_false' ); alongside the snippet.
  • Finally, remove the snippet again and confirm the images value falls back to an empty object with no PHP notices in the log.

Relevant test scenarios

  • Changes should be tested with the browser console open
  • Changes should be tested on different posts/pages/taxonomies/custom post types/custom taxonomies
  • Changes should be tested on different editors (Default Block/Gutenberg/Classic/Elementor/other)
  • Changes should be tested on different browsers
  • Changes should be tested on multisite
  • Console/network: the change alters the shape of the bulk editor's posts response, so the response payload is where the new field is visible and where a PHP notice would surface.
  • Content types: the filter receives the content type as its third argument, so it is worth checking the bulk editor for more than one post type — a regular post type and a custom one — to confirm the right value arrives.

Test instructions for QA when the code is in the RC

  • QA should use the same steps as above.

QA can test this PR by following these steps:

Impact check

This PR affects the following parts of the plugin, which may require extra testing:

  • The bulk editor's posts endpoint: every row in its response gains an images key, so any consumer that asserts on the exact response shape is affected.
  • Both bulk editor post collectors — the indexable one and the post meta fallback — since both now run the new filter once per post in the page.

Other environments

  • This PR also affects Shopify. I have added a changelog entry starting with [shopify-seo], added test instructions for Shopify and attached the Shopify label to this PR.
  • This PR also affects Yoast SEO for Google Docs. I have added a changelog entry starting with [yoast-doc-extension], added test instructions for Yoast SEO for Google Docs and attached the Google Docs Add-on label to this PR.

Documentation

  • I have written documentation for this change. For example, comments in the Relevant technical choices, comments in the code, documentation on Confluence / shared Google Drive / Yoast developer portal, or other.

Quality assurance

  • I have tested this code to the best of my abilities.
  • During testing, I had activated all plugins that Yoast SEO provides integrations for.
  • I have added unit tests to verify the code works as intended.
  • If any part of the code is behind a feature flag, my test instructions also cover cases where the feature flag is switched off.
  • I have written this PR in accordance with my team's definition of done.
  • I have checked that the base branch is correctly set.
  • I have run grunt build:images and committed the results, if my PR introduces or edits images or SVGs.

Innovation

  • No innovation project is applicable for this PR.
  • This PR falls under an innovation project. I have attached the innovation label.
  • I have added my hours to the WBSO document.

Fixes #

@thijsoo thijsoo added changelog: non-user-facing Needs to be included in the 'Non-userfacing' category in the changelog innovation Innovative issue. Relating to performance, memory or data-flow. labels Aug 18, 2026
@thijsoo
thijsoo changed the base branch from trunk to feature/ai-alt-text-image-product August 18, 2026 10:10
@coveralls-official

coveralls-official Bot commented Aug 18, 2026

Copy link
Copy Markdown

Coverage Report for CI Build 0

Coverage decreased (-0.3%) to 56.338%

Details

  • Coverage decreased (-0.3%) from the base build.
  • Patch coverage: 4 uncovered changes across 1 file (9 of 13 lines covered, 69.23%).
  • 1 coverage regression across 1 file.

Uncovered Changes

File Changed Covered %
src/bulk-editor/infrastructure/posts/post-meta-posts-collector.php 5 1 20.0%
Total (4 files) 13 9 69.23%

Coverage Regressions

1 previously-covered line in 1 file lost coverage.

File Lines Losing Coverage Coverage
src/bulk-editor/infrastructure/posts/post-meta-posts-collector.php 1 48.61%

Coverage Stats

Coverage Status
Relevant Lines: 70694
Covered Lines: 39796
Line Coverage: 56.29%
Relevant Branches: 17785
Covered Branches: 10051
Branch Coverage: 56.51%
Branches in Coverage %: Yes
Coverage Strength: 42574.96 hits per line

💛 - Coveralls

@github-actions

This comment has been minimized.

@thijsoo
thijsoo force-pushed the 1396-woo-seo---create-bulk-editor-integration-that-supplies-the-bulk-editor-with-woo-specifics branch from e528c72 to c5087a8 Compare August 27, 2026 13:07
Adds an images field to the bulk editor Post DTO, filled through the new
wpseo_bulk_editor_post_images filter, so add-ons such as Woo SEO can supply
product images and their variations for the table.

The filter and its non-array guard live in Post_Images_Trait, shared by both
post collectors the way Post_Title_Trait already is, so images are supplied
when indexables are disabled and the post meta collector is used too. The
content type is threaded from the query into that collector so the filter
receives it there as well.

Images are deliberately supplied for posts the current user cannot edit: they
are display data rather than the SEO metadata a locked row withholds.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

# Conflicts:
#	src/bulk-editor/domain/posts/post.php
#	src/bulk-editor/infrastructure/posts/indexable-posts-collector.php
#	src/bulk-editor/infrastructure/posts/post-meta-posts-collector.php
#	tests/Unit/Bulk_Editor/Domain/Posts/Post_Test.php
#	tests/Unit/Bulk_Editor/Domain/Posts/Posts_Page_Test.php
#	tests/Unit/Bulk_Editor/Infrastructure/Posts/Indexable_Posts_Collector/Get_Posts_Test.php
#	tests/Unit/Bulk_Editor/Infrastructure/Posts/Post_Meta_Posts_Collector/Get_Posts_Test.php
@thijsoo
thijsoo force-pushed the 1396-woo-seo---create-bulk-editor-integration-that-supplies-the-bulk-editor-with-woo-specifics branch from c5087a8 to ccfb02d Compare August 27, 2026 13:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog: non-user-facing Needs to be included in the 'Non-userfacing' category in the changelog innovation Innovative issue. Relating to performance, memory or data-flow.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant