Make WordPress Core

Opened 10 years ago

Closed 10 years ago

#33664 closed defect (bug) (duplicate)

Create pretty permalinks for unlinked attachments

Reported by: pfefferle's profile pfefferle Owned by: swissspidy's profile swissspidy
Milestone: Priority: normal
Severity: normal Version: 4.4
Component: Permalinks Keywords:
Focuses: Cc:

Description

The URL of an unlinked attachments always uses query params (for example: http://notizblog.org/?attachment_id=6702) if pretty permalinks are enabled or not.

This causes problems with feed links (for example: http://notizblog.org/?attachment_id=6702/feed/) and any other plugins that are using add_rewrite_endpoint (for example: https://github.com/swissspidy/oEmbed-API/blob/master/classes/class-plugin.php#L88)

Change History (4)

#1 @swissspidy
10 years ago

  • Keywords needs-patch added
  • Milestone changed from Awaiting Review to Future Release
  • Owner set to swissspidy
  • Status changed from new to assigned

I can confirm this. The error lies in get_post_comments_feed_link which just appends /feed/ to the permalink if pretty permalinks are enabled. It should check for unattached attachments though.

#2 @pfefferle
10 years ago

I think it is more consistent to use a simple pretty permalink for the attachment (for example http://notizblog.org/attachment/6702) because a lot of plugins might make the same mistake (like we did with the oEmbed API plugin). It is recommended on several codex pages to check the permalink structure like this:

<?php if ( get_option('permalink_structure') ) { echo 'permalinks enabled'; } ?>

https://codex.wordpress.org/Using_Permalinks

#3 @swissspidy
10 years ago

  • Keywords needs-unit-tests added
  • Summary changed from Missing mod_rewrite rule for unlinked attachments to Create pretty permalinks for unlinked attachments

I created #33693 for the feed link problem, leaving this ticket for discussing the permalink stuff.

#4 @SergeyBiryukov
10 years ago

  • Keywords needs-patch needs-unit-tests removed
  • Milestone Future Release deleted
  • Resolution set to duplicate
  • Status changed from assigned to closed

Duplicate of #1914.

Note: See TracTickets for help on using tickets.