Not sure this will help but after dealing with the exact same error message for the last 2 days I finally figured out what was happening. It was simply a matter of attempting to call the function before the system knew it existed.
In my case, I had written the function in a separate–not-publicly-accessible–directory and attempted to call this function in my functions.php
file before I even included the file that contained the function.
Inside my custom_funcs.php
file was this function:
function my_custom_funk($url, $path="", $plugin = '') {
$host = get_this_cust_url( $url );
$url = str_replace( parse_url( WP_PLUGIN_URL, PHP_URL_HOST ), $host, $url );
return $url;
}
Inside of my functions.php
file, I was doing this:
// get the funk
add_filter( 'plugins_url', 'my_custom_funk' );
// Load Custom Functions
include( '/my/non-public/path/custom_funcs.php' );
Once I changed their order to this…
// Load Custom Functions
include( '/my/non-public/path/custom_funcs.php' );
// get the funk
add_filter( 'plugins_url', 'my_custom_funk' );
…the error completely stopped.
Hopefully this helps and saves someone two days of debugging.
Lastly, the posts read here are what lead me to make the change.