Wordpress sets custom title on custom page.

I am trying to create a fully custom page, but using the same functions to create headers and footers in WP. I have it on my page

<?php
include("../wp-blog-header.php");
get_header();
?>
<title>My Custom Title Here</title>
<?php
wp_head();
get_footer();
?>

The page displays everything perfectly, but when I try to add <title>My Custom Title Here</title>after get_header(), I get it in my page source as titlePage not found &#8211; My Custom Title

How to customize the page title? I mean, after loading the page, the name should be<title>My Custom Title Here</title>

+4
source share
1 answer

, , . functions.php, , , get_header().

<?php
include("../wp-blog-header.php");

add_filter( 'wp_title', 'custom_title', 1000 );
function custom_title($title) {
    $title = 'My Custom Title Here';
    return $title;
}
get_header();
?>
<?php wp_head(); get_footer(); ?>
+1

Source: https://habr.com/ru/post/1668663/


All Articles