I have a hook, that detects opening the post(publication):

add_action('the_post', 'post_callback');

function post_callback($post) {
   $post->post_title = "New title";
   $post->post_content = "New content";

It replaces post_title, $post->post_content data on the custom values.

How to change HTML meta data on the page(title, description) inside function: post_callback?

Read more here: How to change meta data(title, description) for current post?


If you know the solution of this issue, please leave us a reply in Comment section, to update the question.

Wordpress related questions and answers: