Sanitizes the current title when retrieving or displaying.
Description
Works like the_title(), except the parameters can be in a string or an array. See the function for what can be override in the $args parameter. The title before it is displayed will have the tags stripped and esc_attr() before it is passed to the user or displayed. The default as with the_title(), is to display the title.
Parameters
$argsstring|arrayoptional
Title attribute arguments. Optional.Default: ''
$beforestringdefault: empty
Markup to prepend to the title.
$afterstringdefault: empty
Markup to append to the title.
$echobooldefault: true for echo
Whether to echo or return the title.
$postWP_Post
Current post object to retrieve the title for.
Return
void|string
Void if 'echo' argument is true, the title attribute if 'echo' is false.
Uses · 4
get_post()Retrieves post data given a post ID or post object.
wp_parse_args()Merges user defined arguments into defaults array.
Signature, return type and hooks compared across 5 parsed releases.
About this page
Parsed data
Generated from the wordpress-develop 6.7.7 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.