The culprit was within an add_filter function. Commenting out the following removed the site title from above the page/post content:
function add_post_content($content) {
if(!is_feed() && !is_home()) {
$content .= '<p>This article is copyright © '.date('Y').' '.bloginfo('name').'</p>';
}
return $content;
}
add_filter('the_content', 'add_post_content');
The first part, “This article is copyright (c)”, printed where you’d expect, but bloginfo(‘name’) was appearing before the rest of the content.
Edit — explanation:
In the WordPress Code Reference, some cryptic advice appears: “This always prints a result to the browser. If you need the values for use in PHP, use get_bloginfo().” Bloginfo()
consists of an echo
statement, so it prints to the browser immediately while the code is being pre-processed.
My call to bloginfo()
within a function in my child theme’s functions.php
was processed before WordPress had a chance to print the page’s or post’s content, so that’s when the output of the function appeared. Instead, get_bloginfo()
only returns the data corresponding to the requested argument.