Make WordPress Core

Opened 13 years ago

Closed 9 years ago

#19890 closed enhancement (fixed)

Filter auto enclosure links before processing

Reported by: niallkennedy's profile niallkennedy Owned by: drewapicture's profile DrewAPicture
Milestone: 4.4 Priority: normal
Severity: minor Version:
Component: Feeds Keywords: has-patch commit
Focuses: Cc:

Description

The do_enclose() function looks through post content for enclosure-worthy URLs, requests the URLs it finds, and stores in post meta.

I use sample code and dummy URLs in my posts: e.g. http://example.com/song.mp3. Right now do_enclose() finds the mention of the MP3, adds it to post meta, which later outputs in rss_enclosure() or atom_enclosure(). If I want to remove the enclosure from final markup I can attach to the added_postmeta action to remove a value after it was requested and inserted or act on the markup generated by rss_enclosure() or atom_enclosure() by emptying the string.

I would like to filter out the auto-discovered enclosure link before it is processed by WordPress, looked up in the database, and HEAD requested. If a filter existed on the parsed enclosure links I could remove links from dummy domains such as "example.com."

Attachments (2)

functions.diff (546 bytes) - added by niallkennedy 13 years ago.
apply_filters on post links
19890.2.diff (882 bytes) - added by stevenkword 9 years ago.
Doc added

Download all attachments as: .zip

Change History (12)

@niallkennedy
13 years ago

apply_filters on post links

#1 @nacin
13 years ago

Similar request: #18506

#3 @chriscct7
9 years ago

  • Milestone changed from Awaiting Review to 4.4

#4 @chriscct7
9 years ago

  • Owner set to chriscct7
  • Status changed from new to assigned

#5 @chriscct7
9 years ago

  • Keywords commit added

#6 @SergeyBiryukov
9 years ago

  • Keywords needs-docs added; commit removed

New filters should be documented as per the documentation standards.

@stevenkword
9 years ago

Doc added

#7 @stevenkword
9 years ago

  • Keywords commit added; needs-docs removed

#8 @wonderboymusic
9 years ago

  • Owner changed from chriscct7 to DrewAPicture

#9 @DrewAPicture
9 years ago

  • Status changed from assigned to accepted

#10 @DrewAPicture
9 years ago

  • Resolution set to fixed
  • Status changed from accepted to closed

In 35288:

Media: Introduce the enclosure_links filter, which makes it possible to adjust the list of audio and video enclosure links derived from post content before querying the database.

Props niallkennedy, stevenkword.
Fixes #19890.

Note: See TracTickets for help on using tickets.