Make WordPress Core

Opened 9 years ago

Last modified 5 years ago

#30172 new enhancement

Request: Filter for get_post_format

Reported by: landwire's profile landwire Owned by:
Milestone: Priority: normal
Severity: normal Version: 4.0
Component: Post Formats Keywords:
Focuses: Cc:

Description

Would it make sense to create a filter in get_post_format()? Then instead of having to write this a few times (in each template)

$format = get_post_format();
if ( false === $format ) {
	$format = 'standard';
}

there could be just one filter in the functions file that does return 'standard' when false is returned:

// Apply filter
add_filter('post_format', 'my_filter');

function my_filter($format) {
        if ( false === $format ) {
	       $format = 'standard';
        }
        return $format;
}

Or something along those lines.....
Just an idea,
Sascha

Change History (1)

#1 @TomHarrigan
9 years ago

Ticket #16149 adds the ability to query posts by standard format. The patch added by Mark Jaquith adds the 'post-format-standard' term, which should allow the standard format to be returned. I believe that's the kind of solution that would be preferable and more beneficial to Post Formats overall.

Note: See TracTickets for help on using tickets.