WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question
Not making much sense, what are you aiming to do? ie. What's the end goal? – t31os Jul 28 '11 at 15:09
up vote 1 down vote accepted

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

Edit the_content function

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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