WordPress.org

Make WordPress Core

#22077 closed defect (bug) (invalid)

attachment_id conditions works like homepage

Reported by: 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 19 months ago.
query.php

Download all attachments as: .zip

Change History (4)

comment:1 webord19 months 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...

webord19 months ago

query.php

comment:2 SergeyBiryukov19 months 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.

comment:3 SergeyBiryukov16 months 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.