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

As a proof of concept, I'd like to create a simple plugin that loads some content, say "hello world" just after the_content on the home page only. How can I do this from a plugin?

share|improve this question
up vote 2 down vote accepted

You mean a filter and a check for is_home()?

add_filter( 'the_content', 'wpse6034_the_content' );
function wpse6034_the_content( $content )
    if ( is_home() ) {
        $content .= '<p>Hello World!</p>';
    return $content;
share|improve this answer
Thought it would be simple :) Thanks Jan! – Scott B Dec 28 '10 at 19:44
Jan, can you tell me how you might alter your example, if I only want my plugin to filter content when the home page is viewed? This example works, but it runs the filter on every page. – Scott B Jan 6 '11 at 12:53
@Scott: Then you want to run add_filter() only when is_home() is true. Remember that you can't check for is_home() only after the query has run, so probably in the init hook? – Jan Fabry Jan 6 '11 at 13:39
Any idea if I want to do something similar? Simple plug-in that creates new custom home page. Nothing comes from active theme. wordpress.stackexchange.com/questions/110118/… – Radek Aug 17 '13 at 7:11

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.