WordPress Permalink Manager Plugin: Difference between revisions
mNo edit summary |
mNo edit summary |
||
(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 /> |