Make WordPress Core

Opened 11 years ago

Closed 9 years ago

#24088 closed enhancement (wontfix)

Update get_users_drafts() to support custom post types

Reported by: navjotjsingh's profile navjotjsingh Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.5.1
Component: Users Keywords: has-patch
Focuses: Cc:


Currently get_users_drafts() access drafts of 'post' type only. Would be useful if it could support custom post types as well.

Attachments (3)

24088.patch (1.3 KB) - added by mordauk 10 years ago.
Add support for passing post types to get_users_drafts()
24088.2.patch (1.3 KB) - added by mordauk 10 years ago.
24088.3.patch (1.3 KB) - added by mordauk 9 years ago.

Download all attachments as: .zip

Change History (11)

#1 @mordauk
10 years ago

+1 for sure, though I think the function should also be updated to use WP_Query in order to leverage existing APIs and take caching into account.

#2 @mordauk
10 years ago

It seems very strange to me that this function only returns the ID and post_title fields instead of standard post objects.

The function isn't actually used anywhere in core, so perhaps we should leave it exactly as is but add a $post_type parameter to the function.

10 years ago

Add support for passing post types to get_users_drafts()

#3 @mordauk
10 years ago

24088.patch adds support for custom post types and adds $user_id to the get_users_draft filter.

#4 @DrewAPicture
10 years ago

  • Keywords has-patch added

Just a couple nitpicks on 24088.patch, but the slash in @param string/array should be a pipe character, |, and $post_type should also be marked 'Optional.'

Unrelated: Does it seem odd that the query string itself is filterable rather than the results here?

#5 @mordauk
10 years ago

I thought it was odd that the query arguments weren't filterable. I chalked it up to the function not being used anywhere in core.

I'd definitely like to make the arguments filterable though I'd worry about backwards compatibility with any plugins that are using the function.

10 years ago

#6 @mordauk
10 years ago

Refreshed patch with correct PHPDoc.

9 years ago

#7 @mordauk
9 years ago

24088.3.patch is an updated patch for src/

#8 @wonderboymusic
9 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to wontfix
  • Status changed from new to closed

This function is unused by core, not inclined to improve it

Note: See TracTickets for help on using tickets.