How to change meta data(title, description) for current post?

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?

Leave a Reply

Your email address will not be published. Required fields are marked *