Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

On my /wp-admin/ page I get this error:

Warning: call_user_func_array() expects parameter 1 to be a valid callback, function 'mytheme_admin_bar_render' not found or invalid function name in /home/rgomme1q/public_html/geoffrey/wp-includes/plugin.php on line 406

And on my edit page I get this error:

Warning: Invalid argument supplied for foreach() in /home/rgomme1q/public_html/geoffrey/wp-content/plugins/dropdown-menu-widget/shailan.DropDownMenu.php on line 239

Apart from these errors, the site functions perfectly. Also the files mentioned are never touched by me and are in their original state. I guess the errors come from a typo in another file, but how do I determine which file is the culprit?

share|improve this question
The culprit is not the file, is the author(s) who developed without WP_DEBUG enabled... –  brasofilo May 27 '13 at 17:53
Have you tried disabling the plugins? Seems the second error is coming from a plugin named 'dropdown-menu-widget'. Try disabling the plugin one by one and try to find out the culprit one. In most of the cases, the upgraded version of WordPress conflicts with the plugin or vise versa. –  Mayeenul Islam May 27 '13 at 17:54
Correction: people develop plugins and themes for free, it's up to the user to make sure they work properly, and to provide feedback to the authors and to help improving the code. –  brasofilo May 27 '13 at 18:00
add comment

closed as too localized by brasofilo, s_ha_dum, toscho May 27 '13 at 22:00

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.If this question can be reworded to fit the rules in the help center, please edit the question.

1 Answer

It is likely a callback function for something. My guess is that somewhere something is trying to use a function named mytheme_admin_bar_render as a callback but that function has not been defined. Something like...


... possibly but there are many, many possibilities.

grep your wp-content folder for mytheme_admin_bar_render, or use an IDE that can do source code searches over entire directories. It is hard to say what to do when you find it. If it is a filter, as above you can probably just comment it out or delete it.

// add_filter('something','mytheme_admin_bar_render');

If it is something more complicated, you may need a different approach.

Without the code for the plugin (and I can't find it) solving the other issue isn't going to be easy. Chance are that the plugin is trying to do something like ...

foreach ($somearray as $k=>$v) {

... where $somearray has not been set or is set to false or some other data type that you can't foreach over. Look for the nearest foreach to that line in the error and try to analyze what is happening. Something like...

if (isset($somearray) && is_array($somearray)) {
    foreach ($somearray as $k=>$v) {

... would probably do it.

share|improve this answer
Thanks :) I was able to find and fix the mytheme_admin_bar_render error! I can't find anything for the other error though. Shailan dropdown plugin has whitespace on the line given in the error. How would you solve that one? –  Forza May 27 '13 at 18:30
The plugin link is this one: wordpress.org/plugins/dropdown-menu-widget I will try to find the foreach you mentioned :) –  Forza May 27 '13 at 21:41
Hmm. No foreach even near that line, and the line self is empty. All other foreaches look good. I still think it has something to do with another file. But how do I know where to search for it? –  Forza May 27 '13 at 21:44
add comment

Not the answer you're looking for? Browse other questions tagged or ask your own question.