Now i face a problem, that i want to add a hook into the the_post. Then i use print_r($post); here display the my print_r content and again display the default content. because i am here in the_loop.so again the content was display.

add_action( 'the_content',  'custom_post' );

  function custom_post() {
    global $post, $wp_query;
    $post_id = $post->ID;

Here i need how to overwrite the default content of the the_post and display my own content.

This is possible in a way, that i use the_title and the_content hook but here the function was call two times then its problem. so plz help me.

  • 1
    Not making much sense, what are you aiming to do? ie. What's the end goal?
    – t31os
    Commented Jul 28, 2011 at 15:09

1 Answer 1


Take a look at my answer here, if you are trying to replace the post content:

Edit the_content function

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.