Site logo

Archived topic

Hook wp_head (custom title)

1 reply · Started by Oliver on December 12, 2020

Viewing posts 1–2 of 2

Hi,

I have one question regarding a hook I created for wp_head.

I want to display a custom title on post pages which is based on some PHP variables. The variables itself are based on an array of values from "Advanced Custom Fields".

My solution:

<?php

// PHP code for the arrays

...

// Display custom title

echo "<title>" . $var_1 . " text " . $var_2 . " text " . $var_3 . " text</title> ";

?>

Everything is working as expected, the title is also displayed correctly inside wp_head, but now I have 2 title tags.

How would I replace the regular wp_title and use my custom hook INSTEAD of wp_title?

Thanks for your help...

This archived topic is closed to new replies.