WordPress.org

Make WordPress Core

Opened 11 years ago

Closed 11 years ago

Last modified 11 years ago

#10865 closed enhancement (wontfix)

Function to get posts based on post title

Reported by: sudar Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Template Keywords:
Focuses: Cc:

Description

Right now we don't have a template function to get posts based on the post title.

We have a function called get_page_by_title (in wp-includes/post.php) which retrieves pages (but not posts) based on title.

I propose a new function get_post_by_title() which could retrieve posts gives page titles.

Attachments (1)

get_post_by_title.patch (889 bytes) - added by sudar 11 years ago.
Patch with get_post_by_title() function

Download all attachments as: .zip

Change History (9)

#1 @sudar
11 years ago

  • Cc sudar@… added

#2 follow-up: @hakre
11 years ago

please add a description of the possible return values to the docblock comment.

#3 in reply to: ↑ 2 @sudar
11 years ago

Replying to hakre:

please add a description of the possible return values to the docblock comment.

Updated the patch with description of the possible return values to the docblock comment.

@sudar
11 years ago

Patch with get_post_by_title() function

#4 @willmot
11 years ago

  • Cc willmot added
  • Milestone changed from Unassigned to 2.9

I'd like to take this further and bring the get_post functionality inline with get_terms by adding a

get_post_by( 'field', 'value', $args = optional ( 'post_type' and/or 'post_status ) ); function.

I'll write a patch if there's any interest.

#5 @hakre
11 years ago

sounds interesting and very useable.

#6 @ryan
11 years ago

  • Milestone changed from 2.9 to Future Release

#7 @sorich87
11 years ago

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

get_page_by_title() now has a post_type parameter

#8 @nacin
11 years ago

  • Milestone Future Release deleted
Note: See TracTickets for help on using tickets.