﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	severity	resolution	keywords	cc
14019	Introduce get_id_by_name()	filosofo	filosofo	"Since 2.9-ish there has been an emphasis on querying objects by slug, for various reasons (especially terms).

Unfortunately, many template functions require either that one be in the Loop or explicitly pass a post object ID.  Currently, to get an object's ID in order to pass it to one of the functions, you have to go through several steps that include querying the object and checking for the necessary properties of the desired result.

'''Proposed New Function'''

int '''get_id_by_name''' ( string ''$name_or_slug'' )

Examples:

{{{
// title of the page with slug ""gallery"":
echo get_the_title( get_id_by_name( 'gallery' ) );

// custom field for post titled ""My Day at the Beach""
echo get_post_meta( get_id_by_name( 'my-day-at-the-beach' ), 'photos-url', true );

// images attached to the ""Employees"" page:
$images = get_children( array('post_parent' => get_id_by_name( 'employees' ), 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image' ) );
"	enhancement	closed	normal		Template	3.0	normal	wontfix	has-patch dev-feedback	toscho admin@…
