Make WordPress Core

Opened 12 years ago

Closed 12 years ago

#22077 closed defect (bug) (invalid)

attachment_id conditions works like homepage

Reported by: starnetwork's profile starnetwork Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.4.2
Component: Query Keywords: has-patch reporter-feedback
Focuses: Cc:

Description

Hi,
in wordpress attachment_id pages
(for example: http://demo.opensourcecms.com/wordpress/?attachment_id=xxx)
the conditions of homepage, both is_front_page and is_home will work on this attachment_id links like on homepage.

Attachments (1)

22077.diff (542 bytes) - added by webord 12 years ago.
query.php

Download all attachments as: .zip

Change History (4)

#1 @webord
12 years ago

  • Cc bordoni.dev@… added
  • Keywords has-patch 2nd-opinion dev-feedback added

I don't know if this is the best approach to the problem but I've solved the problem adding condition for the attachment_id, it must be a numeric value to be passed to absint, otherwise it will return 0 and then later on the condition of marking it as a attachment fails.

Although might be better to change the condition, I don't know...

@webord
12 years ago

query.php

#2 @SergeyBiryukov
12 years ago

  • Component changed from General to Query
  • Keywords reporter-feedback added; 2nd-opinion dev-feedback removed

Could not reproduce the original bug neither in 3.4 nor in 3.5-beta1.

The unconditional absint() is consistent with the other ones above:
http://core.trac.wordpress.org/browser/tags/3.4.2/wp-includes/query.php#L1441

If attachment_id is not a numeric value, then it's not a valid attachment page.

#3 @SergeyBiryukov
12 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to invalid
  • Status changed from new to closed

Feel free to reopen with more information if there's still a problem.

Note: See TracTickets for help on using tickets.