Skip to main content

FeedCompiler

\Benecaster\Feed\FeedCompiler

Class Free

Builds each subscriber and public feed. The one part of it meant for your code is is_compiling(): the reliable way for a filter callback to tell “this output is going into an RSS feed” from “this is a web page”.

Filters such as benecaster_episode_content run in both places, and their arguments can’t tell you which: the third argument is a tier slug on the episode page and in the feed alike, and feeds are also built from cron and cache rebuilds, where nothing about the request says “feed”. Benecaster’s own Listener Support uses it to keep a script-revealed prompt out of feeds.

Methods

Method Visibility Since Description
static is_compiling(): bool Public — True only while a feed is being compiled, including from cron and cache rebuilds. Call it from inside a filter callback to emit feed-safe markup (no JavaScript, no interactive embeds) when it is true.

Notes

⚠ Read it; never open the scope yourself. within_compilation() is how the compiler marks a build, and calling it from your code makes a web page look like a feed to every callback that asks. Compiled feeds are cached per tier, so a change to what your callback emits shows in feeds after the next rebuild. Recipe: Keep web-only markup out of the RSS feed.