Make WordPress Core

Opened 14 years ago

Closed 14 years ago

#15460 closed enhancement (fixed)

Feed format parameter for is_feed()

Reported by: johnbillion's profile johnbillion Owned by:
Milestone: 3.1 Priority: normal
Severity: normal Version:
Component: Feeds Keywords: has-patch
Focuses: Cc:


is_feed() should accept an optional parameter so the feed format can be specified.

For example, a plugin of mine adds a feed format and a helper plugin which works with it needs a simple way to determine the format of the current feed.

I currently use:

function is_flow_feed() {
    return ( 'flow' === get_query_var( 'feed' ) );

Patch coming up.

Attachments (2)

15460.patch (658 bytes) - added by johnbillion 14 years ago.
15460.diff (936 bytes) - added by nacin 14 years ago.

Download all attachments as: .zip

Change History (7)

#1 @nacin
14 years ago

  • Milestone changed from Awaiting Review to 3.1

Sane improvement.

14 years ago

#2 @johnbillion
14 years ago

  • Keywords has-patch added

#3 @nacin
14 years ago

Looks good. I'm making a few changes. Patch attached.

In line with is_singular() and a few others, I'm allowing this to accept an array to check.

Additionally, instead of get_query_var(), we need to use $this->get(). The point of moving the functions to methods is they always reflect the WP_Query object in question, not necessarily $wp_query.

Added docs and cleaned up the logic a little. The method's parameter also needs to be optional.

We also need to account for the query var being 'feed', if no feed is specified, which we'll need to catch by checking the default feed too.

14 years ago

#4 @johnbillion
14 years ago

Good stuff nacin :)

#5 @nacin
14 years ago

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

(In [16447]) Allow is_feed() to drill down the feed being checked. props johnbillion for initial patch, fixes #15460.

Note: See TracTickets for help on using tickets.