WordPress.org

Make WordPress Core

Opened 3 years ago

Closed 22 months ago

Last modified 20 months ago

#15604 closed defect (bug) (fixed)

Empty post leads to use of excerpt in feed

Reported by: niska Owned by: markjaquith
Milestone: 3.5 Priority: normal
Severity: normal Version:
Component: Feeds Keywords: has-patch commit
Focuses: Cc:

Description (last modified by SergeyBiryukov)

The content of my posts are empty. Instead I'm using custom fields. I'm using the filter the_content to format the content. Like this

function my_content($text) {
  $postid = get_the_ID();
  $desc = get_post_meta($postid, 'productdescription', true);
  return $desc;
}

add_filter('the_content', 'my_content', 0);

However. Since the "real" content is empty. It seems as if wordpress, in the feed, use the excerpt, instead of the content.

My temporary solution is to insert a dot "." in the content window and click save.

Attachments (2)

15604.diff (667 bytes) - added by dd32 3 years ago.
15604.2.diff (1.2 KB) - added by SergeyBiryukov 22 months ago.

Download all attachments as: .zip

Change History (9)

comment:1 dd323 years ago

  • Component changed from General to Feeds
  • Keywords has-patch needs-testing 3.2-early added
  • Milestone changed from Awaiting Review to Future Release

Looking at the logic behind the RSS2 Feed, The feed is designed to always have content available.

However, We are not looking at the filtered post_content results, which will skew the feeds to ignoring hooks which add content to the post.

See patch

dd323 years ago

comment:2 SergeyBiryukov22 months ago

  • Keywords commit added; needs-testing removed
  • Milestone changed from Future Release to 3.5

comment:3 follow-up: nacin22 months ago

Unlike get_the_content(), get_the_content_feed() does have the the_content filter in it. Looks good to me. Might be worth a $content = get_the_content_feed() then echo $content, to save the extra processing.

SergeyBiryukov22 months ago

comment:4 in reply to: ↑ 3 SergeyBiryukov22 months ago

Replying to nacin:

Might be worth a $content = get_the_content_feed() then echo $content, to save the extra processing.

Done in 15604.2.diff.

comment:5 markjaquith22 months ago

  • Owner set to markjaquith
  • Resolution set to fixed
  • Status changed from new to closed

In [21235]:

Use the_content_feed() when looking for zero-length post content for RSS2 feeds. Now you can have blank posts with content generated by the_content filters. props SergeyBiryukov. fixes #15604

comment:6 follow-up: mdgl20 months ago

See also #10509, possibly related/duplicate. Two for the price of one?

comment:7 in reply to: ↑ 6 SergeyBiryukov20 months ago

  • Description modified (diff)
  • Keywords 3.2-early removed

Replying to mdgl:

See also #10509, possibly related/duplicate.

Indeed, thanks.

Note: See TracTickets for help on using tickets.