block_core_breadcrumbs_get_post_title()
Gets a post title with fallback for empty titles.
No Hooks.
Returns
String. The post title or fallback text.
Usage
block_core_breadcrumbs_get_post_title( $post_id_or_object );
- $post_id_or_object(int|WP_Post) (required)
- The post ID or post object.
Changelog
| Since 7.0.0 | Introduced. |
block_core_breadcrumbs_get_post_title() block core breadcrumbs get post title code WP 7.0
function block_core_breadcrumbs_get_post_title( $post_id_or_object ) {
$title = get_the_title( $post_id_or_object );
if ( strlen( $title ) === 0 ) {
$title = __( '(no title)' );
}
return $title;
}