Sagamore PTA Wordpress notes: Difference between revisions
(Add Migration section) |
(→Assigning post IDs: Notes about post IDs with migration) |
||
Line 37: | Line 37: | ||
===Assigning post IDs=== |
===Assigning post IDs=== |
||
'''''Don't use:''' Although the following is possible, it's probably better to just use redirects for old content (ala [[Sagamore .htaccess]]) and make new content use unique post IDs by doing [[#Change starting post ID]].'' |
'''''Don't use:''' Although the following is possible, it's probably better to just [[#Migration|import old content]] and/or use redirects for old content (ala [[Sagamore .htaccess]]) and make new content use unique post IDs by doing [[#Change starting post ID]].'' |
||
* [https://wordpress.stackexchange.com/questions/7177/how-can-i-assign-post-a-specific-id-on-creation#answer-7230 migration - How can I assign post a specific ID on creation? - WordPress Development Stack Exchange] |
* [https://wordpress.stackexchange.com/questions/7177/how-can-i-assign-post-a-specific-id-on-creation#answer-7230 migration - How can I assign post a specific ID on creation? - WordPress Development Stack Exchange] |
||
Line 45: | Line 45: | ||
* Might want to know how to [http://vocecommunications.com/blog/2011/03/running-wordpress-from-command-line/ execute from the command line] too |
* Might want to know how to [http://vocecommunications.com/blog/2011/03/running-wordpress-from-command-line/ execute from the command line] too |
||
When importing content, it may be easier for sake of redirecting to assign posts/pages the same ID they had on the export site (especially if the export site exposed IDs in its URL (like the PTA site from 2012-2014)). |
When importing content, it may be easier for sake of redirecting to assign posts/pages the same ID they had on the export site (especially if the export site exposed IDs in its URL (like the PTA site from 2012-2014)). ''This happens automatically with Wordpress's Tools → Import if the IDs aren't already taken.'' |
||
===Page Tagging & Categories=== |
===Page Tagging & Categories=== |
Revision as of 12:52, 23 May 2014
Wordpress notes from the Sagamore Online gang (email • archives • subscribe & more)!
Styling
Bother John Lenz to make it 'perty.
Migration
Importing content from another Wordpress installation can be done with the Tools → Export/Import options. Some notes:
- Media files (attachements) will only import from an "All content" export
- Since "All content" includes elements you might not want to import, like comments or navigation menus, try pruning the XML export file of those elements before importing
- Posts will maintain their Wordpress post IDs if possible!
Addresses (URLs)
Address beautification
Be sure to:
- Admin → Settings → Permalinks → Day and name
- Then: Custom Structure
- Remove the trailing slash
(to get rid of the ugly "?p=#" and default trailing slash)
Change starting post ID
From Sagamore online goals 2014#URL_redirects:
Make the new Wordpress installation use post IDs we haven't used before to avoid collisions (terms and users weren't utilized enough on the old site to bother with), then setup .htaccess redirects from the old to the new as desired.
- On the new Wordpress database:
ALTER wp_posts AUTO_INCREMENT = 2001 ;
Old ideas
Assigning post IDs
Don't use: Although the following is possible, it's probably better to just import old content and/or use redirects for old content (ala Sagamore .htaccess) and make new content use unique post IDs by doing #Change starting post ID.
- migration - How can I assign post a specific ID on creation? - WordPress Development Stack Exchange
- wordpress - insert post ID with wp_insert_post - Stack Overflow
- Function Reference/wp insert post « WordPress Codex
- Might want to know how to execute from the command line too
When importing content, it may be easier for sake of redirecting to assign posts/pages the same ID they had on the export site (especially if the export site exposed IDs in its URL (like the PTA site from 2012-2014)). This happens automatically with Wordpress's Tools → Import if the IDs aren't already taken.
Page Tagging & Categories
Of the two default content types in Wordpress, Pages (unlike the other, Posts), cannot have Tags or Categories associated with them by default. It is relatively simple to change that with some code or a simple plugin:
- Pages are Posts (I like that one for its simplicity)
- Post Tags and Categories for Pages
Only add Tags (not Categories) to Pages: