Maybe you've also asked yourself a few times "how can I change the post status of one or more posts in my ghost blog". Because you migrated from wordpress to ghost and set the status of more than 250 posts to draft long time ago - but want to change that now, after the migration to ghost.
- At first I backed up the sqlite database (17,9 MB) to my Mac. You can find it there:
$webserver/ghost/content/data/ghost.dbIf you are fucked up, there is always a working copy on your webserver. Hopefully! I backuped the DB twice.
- Shortly after, I installed a free sqlite tool to peek around with the dbase, named sqlitebrowser.app and is completely free to use, for Mac OS X (dunno what to do in windows). Download it here. Not nice, but functional enough for our plan.
- Now I started the app and loaded the db into it.
- I firstly executed the following command to see how many posts are affected:
SELECT count(*) FROM posts WHERE status = 'draft'
- Count: 255
- Okay, there are 255 posts in my db which are in state "draft" and not visible for my audience. I need to change that.
- The final command is:
UPDATE posts SET status= 'published' WHERE status = 'draft';
- done. That's all. All the 255 posts are now published. Mass edited by the power of the sql command. Don't forget to click "write changes".
- Upload your edited database back to your server.
- Login to ghost to see if there are any drafts - there shouldn't be one.
It is possible to edit only posts from a specific time, maybe you have drafts from 2009, than you can use the following code and edit it for your needs:
SELECT count(*) FROM posts WHERE created_at = '2005' AND status = 'draft'
This will show all drafts from the year 2005.
Another example, all posts after a specific date:
UPDATE posts SET status= 'published' WHERE created_at = < '2009-09-09 09:09:09' AND status = 'draft';
Hope that helps.
Subscribe to thafaker | TBDTTT
Bekomme die neuesten Beitraege direkt in deinen Briefkasten, literarisch gesehen. Geht aber nicht, dieses Feature :-)