Opened 11 months ago

Closed 9 months ago

#21099 closed defect (bug) (fixed)

The 'allowed_themes' filter has disappeared

Reported by: johnbillion Owned by:
Priority: normal Milestone: 3.4.2
Component: Themes Version: 3.4
Severity: normal Keywords: has-patch
Cc: scribu, lancewillett

Description

r20029 deprecated the get_allowed_themes() function and replaced it with wp_get_themes( array( 'allowed' => true ) ). This also removed the allowed_themes filter.

  1. Is there a replacement filter?
  2. If not, can the allowed_themes filter be reinstated?

Attachments (3)

21099.patch (556 bytes) - added by SergeyBiryukov 11 months ago.
21099.2.patch (708 bytes) - added by SergeyBiryukov 10 months ago.
21099.3.patch (1.1 KB) - added by SergeyBiryukov 10 months ago.

Download all attachments as: .zip

Change History (16)

And just to add a little more context, the allowed_themes filter could previously be used to filter the themes shown on the Themes screen on sites within a network. This is no longer possible.

  • Milestone changed from Awaiting Review to 3.4.2

Yeah, this should be added back to WP_Theme. Seems like WP_Theme::get_allowed() would make the most sense, as there was no filter in wpmu_get_blog_allowedthemes() or get_site_allowed_themes().

  • Keywords has-patch added

comment:4 follow-up: ↓ 6   SergeyBiryukov11 months ago

In 3.3, only get_site_allowed_themes() part was filtered:
http://core.trac.wordpress.org/browser/tags/3.3.3/wp-admin/includes/theme.php#L149

The patch assumes that it would make sense to filter the whole returned array.

  • Cc scribu added

comment:6 in reply to: ↑ 4   nacin10 months ago

Replying to SergeyBiryukov:

The patch assumes that it would make sense to filter the whole returned array.

Not sure that's a good assumption. The filter only acts on a network-wide array, with no context for the blog_id being requested.

We should add in some new filters.

21099.2.patch is another take.

allowed_themes should mirror the 3.3 behaviour. site_allowed_themes is a new filter, which passes $blog_id for context.

comment:8 follow-up: ↓ 9   scribu10 months ago

Wouldn't the 'site_allowed_themes' make more sense inside the get_allowed_on_site() method?

comment:9 in reply to: ↑ 8   SergeyBiryukov10 months ago

Replying to scribu:

Wouldn't the 'site_allowed_themes' make more sense inside the get_allowed_on_site() method?

Indeed. Added network_allowed_themes as well for consistency.

  • Cc lancewillett added

In [21686]:

Restore the 'allowed_themes' filter.

This filter has wrapped the network-wide themes, outside of the network-wide
allowed function (dating back to MU), hence the unusual placement. This restores
previous behavior; we will introduce new filters to enable greater flexibility.

see #21099.
for trunk.

In [21699]:

Restore the 'allowed_themes' filter.

This filter has wrapped the network-wide themes, outside of the network-wide
allowed function (dating back to MU), hence the unusual placement. This restores
previous behavior; we will introduce new filters to enable greater flexibility.

see #21099.
for the 3.4 branch.

  • Resolution set to fixed
  • Status changed from new to closed
Note: See TracTickets for help on using tickets.