wppaste
WordPress

the_title( string $before = '', string $after = '', bool $display = true ): void|string

Since
0.71
Source
wp-includes/post-template.php:43
Displays or retrieves the current post title with optional markup.

Parameters

$beforestringoptional
Markup to prepend to the title. Default empty.Default: ''
$afterstringoptional
Markup to append to the title. Default empty.Default: ''
$displaybooloptional
Whether to echo or return the title. Default true for echo.Default: true

Return

void|string
Void if $display argument is true or the title is empty, current post title if $display is false.

Uses · 1

Used by · 3

Source

function the_title( $before = '', $after = '', $display = true ) {	$title = get_the_title(); 	if ( strlen( $title ) === 0 ) {		return;	} 	$title = $before . $title . $after; 	if ( $display ) {		echo $title;	} else {		return $title;	}}

History

Introduced in 0.71. Unchanged from 6.7.7 through 7.1.0.

  1. 6.7.7
  2. 6.8.8
  3. 6.9.7
  4. 7.0.4
  5. 7.1.0

Signature, return type and hooks compared across 5 parsed releases.

About this page

Parsed data
Generated from the wordpress-develop 7.0.4 tag, from src/wp-includes/post-template.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.
Corrections
Something wrong on this page? Report it and it gets fixed in the next regeneration.