That’s strange… that error could only occur if the main class method is run BEFORE WordPress init is fired. And the main class method is only called at the end of wp_head.
So this is totally inexplicable unless EDD’s receipt output skips do_action('init') but does use do_action('wp_head'). Now why would init be skipped?
I’ll try to reproduce…
It’s the receipt that’s provided in the email. The user clicks on it and it’s a full screen of the receipt. I believe that does in fact bypass the init hooks you mention.
Hmmm, yes. I have reproduced this… and added the Easy Digital Downloads tag so this will appear on the EDD support forum. I hope Pippin Williamson can say something meaningful about this?
Tip: disable PHP errors/warnings being shown publicly. Add @ini_set('display_errors',0); to your wp-config.php or set display_errors=Off in php.ini
I believe that does in fact bypass the init hooks you mention.
But why would it bypass init hooks while respecting wp_head hooks after that?
In any case, could you try the development version https://downloads.wp.xz.cn/plugin/easy-fancybox.zip which should work around the issue.
@pippin – if you’re seeing this, could you explain what is going on with init there on the EDD receipt page?
What is the plugin looping through at that line number? A taxonomy?
What is the plugin looping through at that line number? A taxonomy?
No, an array of settings that should have been loaded into a class property at init. The error comes from an empty property, which either means the hook to init has not run or an error occurred during the process… But I don’t see any other messages or errors in the log preceding the “Invalid argument supplied for foreach()”
Could you show me the relevant action and callback?
@pippin – in the current version a file is included with a require_once via the action
add_action('init', array(__CLASS__, 'init'));
with callback
...
public static function init() {
require_once(EASY_FANCYBOX_PLUGINDIR . 'easy-fancybox-settings.php');
add_filter('embed_oembed_html', array(__CLASS__, 'add_video_wmode_opaque'), 10, 3);
}
...
including http://plugins.svn.ww.wp.xz.cn/easy-fancybox/tags/1.5.7/easy-fancybox-settings.php