Opened 22 months ago

Last modified 18 months ago

#18396 new defect (bug)

Custom post type of "tab" creates query conflict with media uploader.

Reported by: theandystratton Owned by:
Priority: normal Milestone: Awaiting Review
Component: Media Version: 3.0
Severity: normal Keywords: needs-patch
Cc: aaroncampbell, joachim.kudish@…

Description

  1. Create a custom post type with name "tab"
  2. Upload media in (either attached to a post, or not)
  3. Return to media uploader and click on "Library" tab, no images are pulled

The query being called will check for a post_type of tab with the post_name library, looks like it's due to "tab=library" being in the query string. Change the post type or remove the its registration and the problem disappears.

Details: WP 3.0+ (trunk, too), no plugins, TwentyEleven child theme only having a functions.php with the register_post_type function called on init.

I'd love to submit a patch to account for this or it could be listed as a reserved word for custom post types. Looking for direction for next steps.

Change History (8)

  • Cc aaroncampbell added
  • Cc joachim.kudish@… added

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

I haven't checked, but wouldn't this also apply to any CPT that shares a name with a public query var?

Because of this you should always prefix your names.
http://codex.wordpress.org/Post_Types#Naming_Best_Practices

Noted, Alex Mills also pointed this out to me during my session at WCSF.

@johnbillion spoke with Nacin the same day, this is the case... being that I'm relatively new to working with core, can I simply work on and submit a patch or is any approval required?

If it's something that's going to be closed, would rather look at an open bug/ticket for my first patch.

  • Keywords needs-patch added

comment:8 in reply to: ↑ 3   nacin18 months ago

Replying to johnbillion:

I haven't checked, but wouldn't this also apply to any CPT that shares a name with a public query var?

There would be a problem only if the CPT's query variable overwrites an existing public query variable.

tab is not a registered query variable. We consult it via a direct $_GET.

Note: See TracTickets for help on using tickets.