Automattic / WPCOM-Legacy-Redirector

WordPress plugin for handling large volumes of legacy redirects in a scalable manner.
20 stars 16 forks source link

CLI: insert-redirect fails when using post ID #117

Open GaryJones opened 1 year ago

GaryJones commented 1 year ago
$ wp wpcom-legacy-redirector insert-redirect /foo 5
Error: Couldn't insert /foo -> 5 (Redirect is pointing to a Post ID that does not exist.)

Th insert-redirect command fails when using a post ID as the To destination value. Removing a check for the $_POST superglobal, as per #115 fixes it, but then this breaks the UI view:

Screenshot 2023-06-28 at 09 02 26

(The different redirect there is using a /bar To value, rather than a post ID)

115 was reverted in #116, but the problem still likely lies in WPCOM_Legacy_Redirector::vip_legacy_redirect_parent_id().