Opened 21 months ago

Last modified 18 months ago

#18632 new defect (bug)

wp_get_shortlink() Should Always Return a URL

Reported by: cais Owned by:
Priority: normal Milestone: Awaiting Review
Component: Template Version: 3.1
Severity: normal Keywords: has-patch needs-testing
Cc: chip@…

Description

Currently the code used in the link-template.php file causes the wp_get_shortcode function to return an empty result if the WordPress installation is using the default permalink structure. This causes at least issues with the_shortcode function and can be expected to cause issues any place that wp_get_shortcode is called when the default permalink structure is being used.

An alternative is to simply make the inline documentation state an empty result will be returned when the default permalink structure is used.

Attachments (1)

link-template-patch.diff (524 bytes) - added by cais 21 months ago.

Download all attachments as: .zip

Change History (6)

cais21 months ago

  • Cc chip@… added

+1

Cais beat me to the punch!

  • Keywords needs-testing added

comment:3 follow-up: ↓ 4   johnbillion21 months ago

  • Component changed from Shortcodes to Template
  • Summary changed from wp_get_shortcode() Should Always Return a URL to wp_get_shortlink() Should Always Return a URL

comment:4 in reply to: ↑ 3   cais21 months ago

Replying to johnbillion: Good catch, I don't find many issues (and subsequent potential solutions) so I was a bit excited when I wrote up this ticket. Thanks.

  • Version changed from 3.3 to 3.1

To me it seems like the inline documentation should be updated.

Our shortlink API is designed to only provide a shortlink when one is available. If no shorter link is available, I'd rather not return something.

This patch would also be a change from its introduction. Not a backwards incompatible change, granted.

Note: See TracTickets for help on using tickets.