Skip to content

Wordpress: If a theme isn't installed (given the name), an undefined function (themes_api) is called #281

samcleaver opened this Issue Dec 7, 2012 · 7 comments

3 participants


As per the title:
File: includes/presets.php
Function: get_name
Condition: If the theme doesn't exist then themes_api is called (which doesn't exist). Not sure what function this was referring to? Can't find it in the latest Wordpress source anywhere.

//theme isn't installed, use the API to grab the name rather than risk losing data on upgrade
        $api = themes_api( 'theme_information', array( 'slug' => $stylesheet, 'fields' => array( 'sections' => false, 'tags' => false ) ) );

Tracking: Originally raised by a user on the Wordpress forums with 3.3.1 (though checked latest source 3.4.2 as well).

67726e commented Dec 7, 2012

@Beaver6813 I can't find anything related to this in any of the previous tagged releases on the WordPress SVN either. There is an filter hook called themes_api so I'm thinking this is what was meant to be used and this is just some erroneous code? I'll look at this more tonight after work.


themes_api is defined in wp-admin/includes/theme.php since 2.8.


Ahh, I was looking in the main wp-includes folder, probably why I couldn't find it! Are we sure that this function is definitely only used while they're in the admin panel? As that might explain the issue.
Asked the finder for clarification on where they see the issue.


Yeah, looks like the get_name function is being called on the homepage for some reason. Will have a look later (unless one of you guys beats be to it!) as to why.

well .. now I deactivate the plugin and the website works but if I try to activate it .. the website doesnt work at all .. and you go on the website you can only read this:

Warning: Invalid argument supplied for foreach() in /web/htdocs/ on line 591

Fatal error: Call to undefined function themes_api() in /web/htdocs/ on line 598
@67726e 67726e added a commit that referenced this issue Dec 9, 2012
@67726e 67726e Issue #281 Included files needed for `themes_api` call and added util…
…ity methods to handle now deprecated `get_theme(s)` calls
@67726e 67726e closed this Dec 9, 2012

Hmm.. with the fix for this, do we really need to be including presets.php at all if we're not already in the admin panel?

67726e commented Dec 9, 2012

@Beaver6813 It would take a large refactoring, and that is not something I want to engage in at this point.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.