Frage

Is there an exact opposite funciton to this one:

get_the_title(ID) 

I know there's:

get_the_id()

But it doesn't seem to accept any arguments.

So, basically, I'm looking for something like:

$title = 'Something';
get_the_id($title);

I already know this solution:

 global $wpdb;
 $post_name = get_query_var('name');
 $post_id = $wpdb->get_var("SELECT ID FROM $wpdb->posts WHERE post_name = $post_name");

But maybe there's something bulit-in that I'm missing?

Keine korrekte Lösung

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit wordpress.stackexchange
scroll top