WordPress.org

Make WordPress Core

Opened 8 years ago

Closed 8 years ago

#2562 closed defect (bug) (fixed)

Add "only" option to get_*() functions

Reported by: ryan Owned by:
Milestone: 2.1 Priority: normal
Severity: normal Version: 2.0.1
Component: Administration Keywords: query get api bg|has-patch bg|needs testing
Focuses: Cc:

Description

Add an "only" option that contains a list of IDs to include in list queries. This is similar to the existing "exclude" option except instead of excluding IDs from the query it restricts the query to only those IDs specified. get_posts(), get_pages(), get_categories(), and get_bookmarks() need this option.

Attachments (2)

template_functions_bookmark_incl_excl.diff (2.0 KB) - added by MichaelH 8 years ago.
adds exclusion/inclusion to get_bookmarks()
incl_excl_gets.diff (9.2 KB) - added by MichaelH 8 years ago.
include/exclude ids for get_posts(), get_pages(), get_categories(), and get_bookmarks()

Download all attachments as: .zip

Change History (6)

MichaelH8 years ago

adds exclusion/inclusion to get_bookmarks()

comment:1 MichaelH8 years ago

Just a patch for get_bookmarks(). Allows exclusions (which was partially coded) or inclusions. If 'include' is specified in the parameter, sets $exclude = , $category = -1, and $category_name = .

MichaelH8 years ago

include/exclude ids for get_posts(), get_pages(), get_categories(), and get_bookmarks()

comment:2 MichaelH8 years ago

  • Keywords bg|has-patch bg|needs testing added

A patch for get_posts(), get_pages(), get_categories(), and get_bookmarks() to include/exclude specific ids.

comment:3 ryan8 years ago

Code looks good. Time to test.

comment:4 ryan8 years ago

  • Resolution set to fixed
  • Status changed from new to closed

(In [3655]) Add include param to get_posts(), get_categories(), get_pages(), and get_bookmarks(). Props MichaelH. fixes #2562

Note: See TracTickets for help on using tickets.