Make WordPress Core

Opened 13 years ago

Closed 11 years ago

#18632 closed defect (bug) (fixed)

wp_get_shortlink() Should Always Return a URL

Reported by: cais's profile cais Owned by: ryan's profile ryan
Milestone: 3.7 Priority: normal
Severity: normal Version: 3.1
Component: Template Keywords: has-patch needs-testing
Focuses: Cc:


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 13 years ago.

Download all attachments as: .zip

Change History (8)

#1 @chipbennett
13 years ago

  • Cc chip@… added


Cais beat me to the punch!

#2 @chipbennett
13 years ago

  • Keywords needs-testing added

#3 follow-up: @johnbillion
13 years 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

#4 in reply to: ↑ 3 @cais
13 years 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.

#5 @nacin
13 years ago

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

#6 @ryan
11 years ago

  • Milestone changed from Awaiting Review to 3.7

#7 @ryan
11 years ago

  • Owner set to ryan
  • Resolution set to fixed
  • Status changed from new to closed

In 25030:

wp_get_shortlink() improvements.

  • Return shortlinks for pages and public CPTs.
  • Return shortlinks even when cruft-free links are not enabled.
  • Unit tests

Props sillybean, layotte, cais
fixes #18632
see #14760

Note: See TracTickets for help on using tickets.