WordPress.org

Make WordPress Core

Opened 9 years ago

Closed 9 years ago

#2563 closed defect (bug) (fixed)

Add meta_key and meta_value options to get_posts() and get_pages()

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

Description

Allow restricting post and page queries by meta keys and values.
Example: get_posts('meta_key=foo&meta_value=bar')

Attachments (1)

postmeta_val_test_get_posts_and_get_pages.diff (4.2 KB) - added by MichaelH 9 years ago.
In get_posts() and get_pages() test meta_key and meta_value

Download all attachments as: .zip

Change History (5)

comment:1 @MichaelH9 years ago

  • Owner changed from anonymous to MichaelH

@MichaelH9 years ago

In get_posts() and get_pages() test meta_key and meta_value

comment:2 @MichaelH9 years ago

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

Patch allows one (1)'meta_key' and one (1) 'meta_value' parameter in get_posts() and get_pages(). If using 'include' parameter 'meta_key' and 'meta_value' are ignored.

comment:3 @abhay9 years ago

+1 tested on Apache 2.0.55 / PHP 5.1.2 / MySQL 5.0.19

comment:4 @ryan9 years ago

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

(In [3656]) Add meta_key and meta_value options to get_posts() and get_pages(). Props MichaelH. fixes #2563

Note: See TracTickets for help on using tickets.