Answers for "wp get title of page by slug"

PHP
1

wordpress get page slug

// Get the queried object and sanitize it
$current_page = sanitize_post( $GLOBALS['wp_the_query']->get_queried_object() );
// Get the page slug
$slug = $current_page->post_name;
Posted by: Guest on March-02-2021
0

wordpress get site title

You are not outputting anything to show. You are only assigning blog name to a variable. You need to echo the content. It should be :

<h1><?php echo get_bloginfo( 'name' ); ?></h1>
Hope this helps :)
Posted by: Guest on March-08-2021

Browse Popular Code Answers by Language