My WordPress site.

I want to output echo get_the_title($post_id);

Here is the whole code:

 <?php $post_id = get_field('artist_link', false, false); ?> <?php echo get_the_title($post_id); ?> <title><?php echo get_the_title($post_id); ?><?php bloginfo('name'); ?></title> <?php } ?> 

The fact that the top ( <?php echo get_the_title($post_id); ?> ) Will display all the rules, and the fact that the <title> empty is displayed.

Can you tell what the problem is? Or does WP not allow you to display something other than their functions in <title></title> ?

  • get_the_title is the title of a specific post, to display the page header, use wp_get_document_title() (instead of the old wp_title() ) - DaemonHK

0