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: |
|
Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | Awaiting Review |
| Component: | Media | Version: | 3.0 |
| Severity: | normal | Keywords: | needs-patch |
| Cc: | aaroncampbell, joachim.kudish@… |
Description
- Create a custom post type with name "tab"
- Upload media in (either attached to a post, or not)
- 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)
comment:1
aaroncampbell — 22 months ago
- Cc aaroncampbell added
comment:3
follow-up:
↓ 8
johnbillion — 21 months ago
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.
comment:6
SergeyBiryukov — 19 months ago
- Keywords needs-patch added
comment:7
SergeyBiryukov — 18 months ago
Related: #19384
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.

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