Make WordPress Core

Opened 14 years ago

Closed 11 years ago

Last modified 11 years ago

#18396 closed defect (bug) (wontfix)

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

Reported by: theandystratton's profile theandystratton Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.0
Component: Query Keywords:
Focuses: Cc:

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 (12)

#1 @aaroncampbell
14 years ago

  • Cc aaroncampbell added

#2 @jkudish
14 years ago

  • Cc joachim.kudish@… added

#3 follow-up: @johnbillion
14 years ago

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

#4 @ocean90
14 years ago

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

#5 @theandystratton
14 years ago

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.

#6 @SergeyBiryukov
13 years ago

  • Keywords needs-patch added

#8 in reply to: ↑ 3 @nacin
13 years 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.

#9 @c3mdigital
12 years ago

  • Component changed from Media to Query

What this is doing is setting a name and tab query_variable.

dump of the library tab query:

object(WP_Query)[187]
  public 'query_vars' => 
    array (size=51)
      'm' => int 0
      'cat' => string '0' (length=1)
      'paged' => int 1
      'post_type' => string 'attachment' (length=10)
      'tab' => string 'library' (length=7)
      'name' => string 'library' (length=7)
      'posts_per_page' => int 20
      'post_status' => string 'inherit,private' (length=15)
      'error' => string '' (length=0)
      //.....

Investigating further

#10 @ocean90
12 years ago

  • Keywords close added

I think this can be closed since the old media libary is gone.

#11 @c3mdigital
11 years ago

  • Keywords needs-patch close removed
  • Resolution set to wontfix
  • Status changed from new to closed

See comments.

#12 @markoheijnen
11 years ago

  • Milestone Awaiting Review deleted

Clearing out the milestones for closed tickets on Awaiting Review

Note: See TracTickets for help on using tickets.