Change pages into posts or swap database for a Commons site?
Working on our internal site.
Wondering if you could either:
Run this SQL:
UPDATE wp_posts SET post_type = 'post' WHERE post_type = 'page'
I did this on my own server.
Or if I give you a SQL file, can you swap it for what is already there?
The latter is preferred, because on my own server, I radically re-worked the entire taxonomy.
#2 Updated by Raymond Hoh about 2 years ago
- Category name set to WordPress (misc)
- Assignee changed from Boone Gorges to Raymond Hoh
- Target version set to Not tracked
Boone is away at the moment, so I'll be handling this ticket.
I'd rather not deal with SQL exports and imports due to the nature of our caching system, which would require a script to purge all post caches.
Instead, I used a WP-CLI command to convert all existing posts to pages for the
wp post update $(wp post list --post_type='post' --format=ids --url=https://gclibrarywiki.commons.gc.cuny.edu) --post_type=page --url=https://gclibrarywiki.commons.gc.cuny.edu
If you want to manage the ability to convert post types in the admin dashboard, we could install a plugin that handles this. Post Type Switcher appears to be a popular and decent plugin.
About your proposed taxonomy changes, it would be better if you outline what you did locally and what needs to be done for the
#4 Updated by Raymond Hoh about 2 years ago
Oops! Sorry for reading that backwards, Stephen.
I just converted all pages to posts on the
gclibrarywiki site. Let me know if anything needs amending.
About the taxonomy changes, it would probably be better if you used the native WordPress Export / Import tools in the admin dashboard under "Tools".
From your internal site, on the "Tools > Export" page, you can export just the posts (this should include categories). Then, you can remove all the posts from the
gclibrarywiki admin dashboard and use your exported file from your internal site on the "Tools > Import" page.
Note: Before following what I recommend in the previous paragraph, it'd probably be best to do an export of the
gclibrarywiki site just in case! You should also test the import and export process locally as well.
Let me know if you have any questions.