Difference between revisions of "WordPress Permalink Manager Plugin"

Wiki.TerraBase.info
Jump to navigation Jump to search
m
m
Line 94: Line 94:
</syntaxhighlight><br />
</syntaxhighlight><br />


* Bulk edit date of Media Files to update with this date: 1999-09-13
*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
*phpMyAdmin: Query Database, Export (at bottom of query, not on Tab) to CSV


SELECT ID FROM wp_posts WHERE post_date='1999-09-13*';
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: ,
*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;
*Clear Temporary Table;
* Save original SLUG Names;
 
TRUNCATE TABLE LifeOfTheSaltonSea_org_WP.TT2;
 
*Save original SLUG Names in Temporary Table;


INSERT INTO LifeOfTheSaltonSea_org_WP.TT2 (ID, post_name)
INSERT INTO LifeOfTheSaltonSea_org_WP.TT2 (ID, post_name)
Line 111: Line 114:
WHERE post_date LIKE '1999-09-13%';
WHERE post_date LIKE '1999-09-13%';


* Modify the SLUG (post_name)
*Modify the SLUG (post_name)


UPDATE LifeOfTheSaltonSea_org_WP.wp_posts
UPDATE LifeOfTheSaltonSea_org_WP.wp_posts
Line 118: Line 121:


WHERE post_date LIKE '1999-09-13%';
WHERE post_date LIKE '1999-09-13%';
* 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;


<br />
<br />

Revision as of 20:22, 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%';

  • 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;