WordPress Permalink Manager Plugin: Difference between revisions
Created page with "Make sure all TARGET Media is attached to a Page (not a Timeline Event) Wordpress calculates the Default URI / Original URL* as WhatEverItIsAttachedTo(IfItIsAttached)/Na..." |
mNo edit summary |
||
(4 intermediate revisions by the same user not shown) | |||
Line 5: | Line 5: | ||
The NativeSlug is stored in the wp_posts.post_name Table.Column, and can be easily modified with a SQL query | The NativeSlug is stored in the wp_posts.post_name Table.Column, and can be easily modified with a SQL query | ||
"Tag" the desired media to change with a custom date (1999-09-13, AKA September 13, 1999) using the Bulk Edit feature of Admin Columns | "Tag" the desired media (WhatEver1) to change with a custom date (1999-09-13, AKA September 13, 1999) using the Bulk Edit feature of Admin Columns | ||
Use a SQL Query to add / prepend the new custom path (example: recent-history/images/, no leading /, but add the trailing) | Use a SQL Query to add / prepend the new custom path (example: recent-history/images/, no leading /, but add the trailing) | ||
Permalink Manager, Tools, Regenerate / Reset, Mode: Use Original (Default) URLs as custom permalinks | Change date back to original or current | ||
Then go to the next desired media and tag it (WhatEver2, 3, etc.) and repeat the above steps (3 lines) | |||
...and after all SQL Modifications; Permalink Manager, Tools, Regenerate / Reset, Mode: Use Original (Default) URLs as custom permalinks | |||
OR, go to debug tab (far right) and wipe all data. | |||
Optional (Not recommended as it can be done via SQL): Permalink Manager, Tools, Regenerate / Reset, Mode: Regenerate Native Slug | Optional (Not recommended as it can be done via SQL): Permalink Manager, Tools, Regenerate / Reset, Mode: Regenerate Native Slug | ||
Line 28: | Line 34: | ||
recent-history/attachment/salton-sea-stuck-boat-high-res-no-rv-not-as-vivid22 | recent-history/attachment/salton-sea-stuck-boat-high-res-no-rv-not-as-vivid22 | ||
<br /><syntaxhighlight lang="text"> | |||
one to many | |||
SELECT * FROM wp_posts WHERE post_date='1999-09-13*'; | |||
SELECT * FROM wp_posts WHERE post_date LIKE '1999-09-13%'; | |||
This works to display: SELECT ID FROM wp_posts WHERE post_date LIKE '1999-09-13%'; | |||
This works to insert into another table (clear the TT2 table first) | |||
INSERT INTO TT2 (ID, post_date) | |||
SELECT ID, post_date | |||
FROM wp_posts | |||
WHERE post_date LIKE '1999-09-13%'; | |||
SELECT * FROM wp_postmeta WHERE post_id = '2799'; | |||
SELECT * FROM wp_postmeta WHERE post_id = (SELECT ID FROM TT2 WHERE ID = '2799'); | |||
SELECT * FROM wp_postmeta WHERE post_id = (SELECT ID FROM TT2 WHERE ID = ?); | |||
SELECT * FROM wp_postmeta WHERE post_id = (SELECT ID FROM TT2 WHERE ID LIKE '%'); | |||
SELECT * | |||
FROM wp_posts | |||
INNER JOIN wp_postmeta | |||
ON wp_posts.ID = wp_postmeta.post_id | |||
WHERE post_date LIKE '1999-09-13%'; | |||
SELECT * | |||
FROM wp_postmeta | |||
INNER JOIN wp_posts | |||
ON wp_posts.ID = wp_postmeta.post_id | |||
WHERE wp_posts.post_date LIKE '1999-09-13%'; | |||
set autocommit=0; | |||
COMMIT; | |||
# or if you want to reset changes | |||
ROLLBACK; | |||
</syntaxhighlight><br /> | |||
*Bulk edit date of Media Files to update with this date: 1999-09-13 | |||
*phpMyAdmin: Query Database, Export (at bottom of query, not on Tab) to CSV | |||
SELECT ID FROM wp_posts WHERE post_date='1999-09-13*'; | |||
*Textpad: Remove " characters using ALT & Mouse OR Replace with nothing, Replace, Regular expression Checkbox, Find: \r (carriage return), Replace: , | |||
*Clear Temporary Table; | |||
TRUNCATE TABLE LifeOfTheSaltonSea_org_WP.TT2; | |||
*Save original SLUG Names in Temporary Table; | |||
INSERT INTO LifeOfTheSaltonSea_org_WP.TT2 (ID, post_name) | |||
SELECT ID, post_name | |||
FROM LifeOfTheSaltonSea_org_WP.wp_posts | |||
WHERE post_date LIKE '1999-09-13%'; | |||
*Modify the SLUG (post_name) | |||
UPDATE LifeOfTheSaltonSea_org_WP.wp_posts | |||
SET post_name = CONCAT("recent-history/images/", post_name) | |||
WHERE post_date LIKE '1999-09-13%'; | |||
*THE BELOW IS CURRENTLY NOT WORKING WHEN USING: Use Permalink Manager (Permalink Manager, Tools, Regenerate / Reset, Mode); | |||
Mode: Use Original (Default) URLs as custom permalinks | |||
Select content type: N/A | |||
Select post types: Media | |||
Select post statuses: Published | |||
Select IDs: Use CSVs obtained | |||
Regenerate Button | |||
*Put original values from the Temporary Table back into the Permanent Table | |||
USE LifeOfTheSaltonSea_org_WP | |||
UPDATE wp_posts | |||
INNER JOIN TT2 ON (wp_posts.ID = TT2.ID) | |||
SET wp_posts.post_name = TT2.post_name; | |||
* Check the Permanent Table | |||
SELECT * FROM wp_posts WHERE post_date='1999-09-13*'; | |||
<br /> |