Add support for fetching postFormats supported by the active theme

Description

Noticed that wp.getPostFormats always returns the full list of Formats, even if the active theme doesn’t support most of them. It just calls get_post_format_strings() to get the list.

I recently added the support for postFormat into WordPress 4 BlackBerry and the users feedback confirm that showing the full list is not so good, because the dashboard instead shows only the post_formats supported by the theme. We should use the same behavior on both places.

Change History (7)

The main issue here is that it would require an additional XML-RPC call to fetch which formats are supported. If you store this information in memory, you won't know when to refresh it, so you'll need to deal with that as well.

I believe that concern was expressed by josephscott originally. The change came out of #15405, but that may have come from a conversation in IRC.

I imagine we should at least add a parameter that allows you to only ask for what is specifically supported. I'm fine with that for 3.2, and it should allow app makers to then make these decisions on their own.

The idea is that clients that specifically ask for this will know that the response format has changed slightly. I'm not entirely thrilled with this approach but given the current constraints it seems like a possibly reasonable trade off.

To get the additional data the method call would be wp.getPostFormats( 'blog_id', 'username', 'password', array( 'show-supported' => TRUE ) ).