<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="bbPress/1.0.1" -->
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title>Gravity Support Forums Topic: Warning: Cannot modify header information - headers already sent by...</title>
		<link>https://legacy.forums.gravityhelp.com/topic/warning-cannot-modify-header-information-headers-already-sent-by</link>
		<description>Gravity Support Forums Topic: Warning: Cannot modify header information - headers already sent by...</description>
		<language>en-US</language>
		<pubDate>Mon, 20 Apr 2026 08:28:47 +0000</pubDate>
		<generator>http://bbpress.org/?v=1.0.1</generator>
		<textInput>
			<title><![CDATA[Search]]></title>
			<description><![CDATA[Search all topics from these forums.]]></description>
			<name>q</name>
			<link>https://legacy.forums.gravityhelp.com/search.php</link>
		</textInput>
		<atom:link href="https://legacy.forums.gravityhelp.com/rss/topic/warning-cannot-modify-header-information-headers-already-sent-by" rel="self" type="application/rss+xml" />

		<item>
			<title>kyleoliveiro on "Warning: Cannot modify header information - headers already sent by..."</title>
			<link>https://legacy.forums.gravityhelp.com/topic/warning-cannot-modify-header-information-headers-already-sent-by#post-33189</link>
			<pubDate>Mon, 22 Aug 2011 11:21:23 +0000</pubDate>
			<dc:creator>kyleoliveiro</dc:creator>
			<guid isPermaLink="false">33189@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;I'm getting the above message as an error every time I perform certain administrative actions in my WP dashboard (e.g. deleting a post, editing code in Appearance &#38;gt; Editor, etc.)&#60;/p&#62;
&#60;p&#62;It seems that this problem only arises when I add the following code to my functions.php:&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;&#38;lt;?php

add_filter(&#38;quot;gform_post_submission_1&#38;quot;, &#38;quot;gform_set_post_thumbnail&#38;quot;);

function gform_set_post_thumbnail($entry){

    // get post ID of the created post

    $post_id = $entry[&#38;quot;post_id&#38;quot;];

    // get the last image added to the post

    $attachments = get_posts(array(&#38;#39;numberposts&#38;#39; =&#38;gt; &#38;#39;1&#38;#39;, &#38;#39;post_parent&#38;#39; =&#38;gt; $post_id, &#38;#39;post_type&#38;#39; =&#38;gt; &#38;#39;attachment&#38;#39;, &#38;#39;post_mime_type&#38;#39; =&#38;gt; &#38;#39;image&#38;#39;, &#38;#39;order&#38;#39; =&#38;gt; &#38;#39;ASC&#38;#39;));

    if(sizeof($attachments) == 0)

        return; //no images attached to the post

    // set image as the post thumbnail

    set_post_thumbnail($post_id, $attachments[0]-&#38;gt;ID);

}&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;I require this code as its function is to set the image uploaded in my Gform to be the Featured Image of the user-submitted post.&#60;/p&#62;
&#60;p&#62;Would appreciate any help on this matter :)&#60;/p&#62;
&#60;p&#62;EDIT: Resolved this myself. I simply moved the code that I quoted above to the top of functions.php.
&#60;/p&#62;</description>
		</item>

	</channel>
</rss>
