handbook icon indicating copy to clipboard operation
handbook copied to clipboard

PowerShell spam-comment deletion example passes multiple IDs as one argument

Open qorud02 opened this issue 2 months ago • 0 comments

In guides/common-tasks.md, the “Delete spam comments” example recommends this command for PowerShell:

wp comment delete $(wp comment list --status=spam --format=ids)

When the inner command outputs one line containing 11 22, PowerShell passes "11 22" as one argument to wp comment delete. It does not split that line into two ID arguments as Bash does.

I reproduced the shell behavior on Windows 11 with Windows PowerShell 5.1.26100.9549, PowerShell 7.6.5, WP-CLI 2.12.0 and PHP 8.4.26. A non-destructive before_wp_load WP-CLI command fixture emitted space-separated IDs and reported the received arguments. The original example produced ["11 22"]; splitting the output with -split '\s+' produced ["11","22"]. A guard also avoids invoking deletion when there are no spam IDs.

The guide should keep its Bash example and provide a PowerShell version that splits the output into separate arguments.

AI assistance: OpenAI Codex helped reproduce the shell behavior and prepare this report and the proposed documentation change.

qorud02 avatar Oct 02 '26 01:10 qorud02