What is the wordpress page title php code?

admin2025-06-06  4

I have a header file in WordPress theme which always shows site title after the creation of a new page because of code <?php echo esc_html( get_bloginfo( 'name' ) ); ?> but I want it to replace with current page title instate of site name so, what would be PHP code for that?

I have a header file in WordPress theme which always shows site title after the creation of a new page because of code <?php echo esc_html( get_bloginfo( 'name' ) ); ?> but I want it to replace with current page title instate of site name so, what would be PHP code for that?

Share Improve this question edited Nov 11, 2018 at 21:22 fuxia 107k39 gold badges255 silver badges461 bronze badges asked Nov 11, 2018 at 17:33 Azahar Uddin AhmedAzahar Uddin Ahmed 32 bronze badges 1
  • Are you referring to the <title> tag? – Jacob Peattie Commented Nov 12, 2018 at 6:24
Add a comment  | 

1 Answer 1

Reset to default -2

Try below code.

global $post;
echo esc_html( get_the_title($post->ID) );
转载请注明原文地址:http://conceptsofalgorithm.com/Algorithm/1749191601a317130.html

最新回复(0)