[wp-trac] [WordPress Trac] #54024: Internal links with href=outdated-slug and a data-type data-id as fallback should use that and update href=new-slug instead of resulting in broken link (404)

WordPress Trac noreply at wordpress.org
Fri Aug 27 13:16:20 UTC 2021


#54024: Internal links with href=outdated-slug and a data-type data-id as fallback
should use that and update href=new-slug instead of resulting in broken
link (404)
--------------------------+-----------------------------
 Reporter:  abitofmind    |      Owner:  (none)
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  General       |    Version:
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 **1) The main expectation is in the issue title:**
 - Internal links, that are inline A elements with href=outdated-slug and
 which have the attributes data-type data-id as fallbacks should indeed use
 that fallback and update href=new-slug instead of resulting in a broken
 link (404), as I experienced it on **Wordpress 5.8 on a PHP 8 server with
 the Astra theme**.

 Thoughts:
 - Maintaining and updating internal pretty-URLs, I deem that a core
 feature of a CMS.
 - I really hope it's only a bug, but that use case in general is handled
 by WordPress or if not by a pretty - robust and popular plugin
 (recommendations appreciated, if that's the case!).

 **2) An appreciated feature would be: When changing a post's title (for
 all post types!) offer an option to bulk process the link text of incoming
 links.**

 - Definition of "link text" a.k.a. "link label" a.k.a. "navigation label":
  - That is the text between the opening and closing of the html a tag:
 {{{
 <a href="/slug-remains-same-or-gets-changed">
 Link Label was like Old Title or was a Custom Label
 <a/>`
 }}}

 - Overall expectation: If a link has a custom link text, I'd expect that
 no automatic mechanism of Wordpress ever kicks in, but the link text
 remains as is, as the link creator surely put some (contextual)
 consideration into it.

 - When changing a page's title or slug, it would be cool to have these
 "Processing options" in a "Title Widget" of Gutenberg or the Classic
 Editor:
 {{{
 For internal incoming links update their link text to the new title?
 (•) Don't change existing link text at all!
 ( ) Only if the old link text was exactly the old title [√] and in the
 same case
 ( ) Regardless of the old title  ⚠️
 }}}
     - Note: The options and also the defaults are sorted from no changes
 at all to most destructive.
     - Hover/click on ⚠️ gives this tooltip: Warning: Authors probably put
 special contextual consideration when creating custom link text (aka
 label). This resets all those link texts to the new title. It is an un-
 doable batch operation! In doubt, first perform a backup.

 **Followup**

 - For both 1+2 see my screenshot series full with annotations, which will
 be attached below.

 - Questions:
  - I'm not sure into which component this falls.
  - Whether 2) should be a separate ticket.
  - I used Gutenberg's "Insert link" feature and this creates the markup.
 But I am pretty sure what I observed is not Gutenberg-specific, but that
 generated markup and its handling the the database for rendering, is core
 functionality.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/54024>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list