Sometimes I want a list of blog posts that contain a certain string. For example, I might want a list of all blog posts that contain the word “kazoo” using WP CLI. My favorite tool for this is wp post list.
While the documentation for wp post list doesn’t list search specifically, it does say
Display posts based on all arguments supported by WP_Query().
One of the arguments WP_Query() accepts is s (for search), so we can run
wp post list --s='kazoo'
and get the list of posts with the word kazoo in it.
+------+---------------------+-----------+---------------------+-------------+
| ID | post_title | post_name | post_date | post_status |
+------+---------------------+-----------+---------------------+-------------+
| 9873 | WP CLI Find in Post | | 2024-08-09 14:37:10 | draft |
+------+---------------------+-----------+---------------------+-------------+
Leave a Reply