PLEASE NOTE: These forums are no longer utilized and are provided as an archive for informational purposes only. All support issues will be handled via email using our support ticket system. For more detailed information on this change, please see this blog post.

Shortcode won't work in filter

  1. extreme-south
    Member

    I'm using a well known filter function to automatically add text in new posts. Works like a charm But if I try to add a Gravity form shortcode in there it fails. Why? Is there any way to get the shortcode to work?

    <?php
    add_filter( 'default_content', 'my_editor_content' );
    
    function my_editor_content( $content ) {
    	$content = "[gravityform id="1" name="testform" description="false"]";
    	return $content;
    }
    ?>
    Posted 12 years ago on Friday November 23, 2012 | Permalink
  2. David Peralty

    Try swapping out the double quotes inside the shortcode with single quotes and let me know if that works any better.

    Posted 12 years ago on Friday November 23, 2012 | Permalink
  3. extreme-south
    Member

    Brilliant! Thanks so much :-)

    Posted 12 years ago on Friday November 23, 2012 | Permalink