WordPress.org

Make WordPress Core

Opened 4 years ago

Closed 20 months ago

Last modified 16 months ago

#18396 closed defect (bug) (wontfix)

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

Reported by: 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)

comment:1 @aaroncampbell4 years ago

  • Cc aaroncampbell added

comment:2 @jkudish4 years ago

  • Cc joachim.kudish@… added

comment:3 follow-up: @johnbillion4 years ago

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

comment:4 @ocean904 years ago

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

comment:5 @theandystratton4 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.

comment:6 @SergeyBiryukov3 years ago

  • Keywords needs-patch added

comment:8 in reply to: ↑ 3 @nacin3 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.

comment:9 @c3mdigital20 months 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

comment:10 @ocean9020 months ago

  • Keywords close added

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

comment:11 @c3mdigital20 months ago

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

See comments.

comment:12 @markoheijnen16 months ago

  • Milestone Awaiting Review deleted

Clearing out the milestones for closed tickets on Awaiting Review

Note: See TracTickets for help on using tickets.