Support » Plugins » Plugin Renders a Mysterious “1”

  • I just wrote my first plugin this weekend. It’s a very simple, specialized one that I needed to make the site do what the client wanted — a specialized form.

    It consists of 2 files: the main .php file, and an include .php file. It’s just a filter for the_content:

    <?php
    function send_postcard($content)
    {
    	$boyd_postcard_search = '<!--SendPostcard-->';
    	if ( substr_count($content, $boyd_postcard_search) == 1 )
    	{
    		$content = include('postcard_include.php');
    		return $content;
    	}
    	else
    	{
    		return $content;
    	}
    }
    add_filter('the_content', 'send_postcard');
    ?>

    The include file is code for inserting and processing the form, which works flawlessly outside of WordPress. It actually works fine inside of WP too, but with one problem: I’m getting a mysterious “1” appearing after the code generated by the plugin.

    Any ideas why this may be happening? Thanks!

  • The topic ‘Plugin Renders a Mysterious “1”’ is closed to new replies.