My pages are all showing the Site Title (from the Customizer) after the page or post title and before the "body" of the post. Troubleshooting by injecting lines of text to print before and after WordPress code narrows the source down to the the_content() call within the page template.

Here's how the_content() is called:

        </header><!-- .entry-header -->

        <div class="content entry-content">
            <?php the_content(
                // Translators: %s: Name of current post. Only visible to screen readers.
                sprintf( esc_html__( 'Continue reading %s', 'bulmapress' ), '<span class="screen-reader-text">' . the_title( '', '', false ) . '</span>' )

            wp_link_pages( array(
                'before' => '<div class="page-links">' . esc_html__( 'Pages:', 'bulmapress' ),
                'after'  => '</div>',
                ) );
        </div><!-- .entry-content -->

        <footer class="content entry-footer">

I'm a bit baffled because post_template.php where the_content() and get_the_content() are defined is a WordPress /includes file, not a parent theme file.

Should I be looking for some filter that's been defined in the theme? TIA

  • esc_html__ in the first param of sprintf might lead to unexpected results, I think. Try removing that, or moving it to the second parameter.
    – vancoder
    Commented May 28, 2021 at 20:39
  • Thanks for the suggestion, I tried removing all params from the_content() and it works just the same (content and site title). Commented May 28, 2021 at 20:42
  • I looked for all instances of add_filter( in the parent theme. There are two, and neither has anything to do with the site title. Commented May 28, 2021 at 20:42

1 Answer 1


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 &copy; '.date('Y').'&nbsp;'.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.

  • 1
    Oh I see. bloginfo outputs. You should have used get_bloginfo.
    – vancoder
    Commented May 28, 2021 at 20:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.