Difference between revisions of "WordPress Permalink Manager Plugin"
m |
m |
||
(3 intermediate revisions by the same user not shown) | |||
Line 34: | 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 /> |
Latest revision as of 20:31, 24 March 2020
Make sure all TARGET Media is attached to a Page (not a Timeline Event)
Wordpress calculates the Default URI / Original URL* as WhatEverItIsAttachedTo(IfItIsAttached)/NativeSlug (It is not saved, instead calculated)
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 (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)
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
*NOTE: Permalink Manager exchanges the use of "Current URI" with "Custom Permalink" in the Regenerate/Reset Tool
...and "Default URI" with "Original URLs" too.
Permalinks Manager: Regenerate custom permalinks and Use original URLs as custom permalinks does the same thing
(The Default URI is copied to the Current / Custom URI)
recent-history11/attachment11/salton-sea-stuck-boat-high-res-no-rv-not-as-vivid11
recent-history/attachment/salton-sea-stuck-boat-high-res-no-rv-not-as-vivid22
recent-history11/attachment11/salton-sea-stuck-boat-high-res-no-rv-not-as-vivid11
recent-history/attachment/salton-sea-stuck-boat-high-res-no-rv-not-as-vivid22
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;
- 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*';