xam1311,
il y a 11 ans
pourquoi pas ça ?
$page = get_page_by_title( $post1_slug );
là tu utilises le vrai titre et non le slug
ou bien directement de la doc
$the_slug = 'my_slug';
$args=array(
'name' => $the_slug,
'post_type' => 'post',
'post_status' => 'publish',
'numberposts' => 1
);
$my_posts = get_posts($args);
if( $my_posts ) {
echo 'ID on the first post found '.$my_posts[0]->ID;
}
?>
++