如何在命令行中使用wp cli删除单个帖子? 时间:2019-07-01 作者:Vabbie 我想在命令行中使用wp cli删除一篇文章。有一篇文章出现了一些问题,其中我的主机禁用了网络&;现在希望我使用控制台删除该文章。我不知道怎么做。请提供关于如何定位和删除该帖子的确切命令。 1 个回复 SO网友:leymannx 请阅读文档。它是wp post delete POST-ID.# Delete post skipping trash $ wp post delete 123 --force Success: Deleted post 123. # Delete all pages $ wp post delete $(wp post list --post_type=\'page\' --format=ids) Success: Trashed post 1164. Success: Trashed post 1186. # Delete all posts in the trash $ wp post delete $(wp post list --post_status=trash --format=ids) Success: Deleted post 1268. Success: Deleted post 1294. 通过标题或元值使用获取帖子wp post list 并将输出传递给wp post delete 如上图所示。按标题或元值获取帖子:WP-CLI How to generate a list of posts with corresponding meta valuesUsing wp-cli can I not query pages by their title? 文章导航