From the course: WordPress: WP-CLI
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Managing existing posts - WordPress Tutorial
From the course: WordPress: WP-CLI
Managing existing posts
- [Instructor] When it comes to posts, you can do everything from add new posts to get a list of existing posts based on specific criteria. So here's a look at how wp post works. Using wp help post, you can see a list of subcommands for creating, deleting, updating, and even generating posts. But before we do any of that, let's just get a list of posts. So we'll write wp post list and I am doing this on a blog I've had for a long time. So we have a lot of posts, over a thousand that we're working with. And on a new site, this is pretty manageable, but on a site with over 1,000 posts, sifting through these can be pretty tough. But the way wp post list works is we can pass any key value pair from wp query to the command. So if we only want the most recent 10 posts, we can write wp post list and then dash dash and then the wp query key value pair we want. In this case, it would be posts_per_page equals 10. So you can…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.