开发者

Wordpress SQL Command to Set all posts by author John Doe to draft

I'm 开发者_开发百科importing posts from another site. I've set all the posts to a specific author (John Doe in this case) and I now want to run an SQL query (in PHPMyAdmin) that gets all John's posts and sets them to draft. Ideas?


Assuming the database schema is the same as the one I found here, you could accomplish this with the following query:

Update wp_posts
INNER JOIN wp_users
on wp_posts.post_author = wp_users.id
SET wp_posts.post_status = 'draft'
WHERE wp_users.user_login ='john doe' and wp_posts.post_type ='post'

If you know the userid of "john doe" you can use

Update wp_posts
SET post_status = 'draft'
WHERE post_author =12345 and post_type ='post'

You may also want to see this support topic at Wordpress

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜