Skip to content

Fix --only flag: respect all post types#250

Open
jessedyck wants to merge 2 commits into
10up:developfrom
jessedyck:fix/only-flag-post-type-pagination
Open

Fix --only flag: respect all post types#250
jessedyck wants to merge 2 commits into
10up:developfrom
jessedyck:fix/only-flag-post-type-pagination

Conversation

@jessedyck

@jessedyck jessedyck commented Jul 18, 2026

Copy link
Copy Markdown

Fixes #251.

Problem

When using --only=<ids>, the query still applied the default post_type => ["post", "page"] constraint. Any IDs belonging to custom post types were silently dropped from the migration queue.

Fix

Set post_type = "any" inside the --only branch so all explicitly supplied IDs are included regardless of their post type.

Test

# migrate a mix of posts, pages, and custom post type IDs
wp convert-to-blocks start --only=1,2,3,100,101
# all IDs should appear in the migration queue regardless of post type

🤖 Generated with Claude Code

When --only is used with explicit post IDs, the query still applied the
default post_type constraint (['post', 'page']), so any IDs belonging to
custom post types were dropped from the migration queue without warning.

Set post_type='any' inside the --only branch so all explicitly supplied
IDs are respected regardless of their post type.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@jessedyck
jessedyck force-pushed the fix/only-flag-post-type-pagination branch from c6c742b to 52671e6 Compare July 18, 2026 11:24
Covers the confirmed bug (custom post type IDs silently dropped when
using --only), the expected filtering to only the specified IDs, and
that the default query (without --only) excludes custom post types.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@jessedyck

Copy link
Copy Markdown
Author

Tests verified locally via npm run test:php (wp-env): 16/16 pass including the 3 new MigrationAgentTest cases.

@jessedyck jessedyck changed the title Fix --only flag: respect all post types and disable pagination Fix --only flag: respect all post types Jul 18, 2026
@jessedyck
jessedyck marked this pull request as ready for review July 18, 2026 12:00
@dkotter
dkotter requested review from peterwilsoncc and removed request for dkotter, dsawardekar and jeffpaul July 20, 2026 16:28
@dkotter dkotter added this to the 1.4.0 milestone Jul 20, 2026
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.

Bug: --only flag silently drops custom post type IDs from migration queue

2 participants