Warning: fread() expects parameter 1 to be resource

Warning- fread() expects parameter 1 to be resource


When I was migrating my page from localhost to production server, I got this warning message:

Warning: fread() expects parameter 1 to be resource, boolean given in .../www/wp-includes/functions.php on line 4837

The only article mentioning this issue is this one in the wordpress support thread. But the author of the plugin doesn’t address the issue. @kernel52 says you should

a) change the theme of the website
b) disable and re-enable the plugin
c) then switch back to the theme you were using

but that doesn’t worked for me.


After more investigation I have found the code in functions.php that was causing the issue. I think it’s because of the freemium feature. What worked for me is:

1. change $__DIR variable on line 26

// $__DIR = dirname( __FILE__ );
$__DIR = plugin_dir_path( __FILE__ );

2. comment out the freemium feature on line 71:

require_once $__DIR . '/analytics/initialize.php';
// require_once $__DIR . '/analytics/initialize.php';

3. navigate from the plugins page somewhere else. (don’t test it while you are in plugins page).

And that’s it. Hope it helped.

Related Post

Right-Click to Translate (Look Up) with Google Tra... If you are not native english speaker, you may be frustrated with default "look up" options you get after selecting a text and right clicking. There a...
FREE ePub Quicklook and Spotlight Plugins for Mac ... When you have a lot of ePub books, it can be useful to see excerpt and meta data information in quicklook. Even more important...
Convert HEIC to JPG on Right Click for Free Convert HEIC to JPG on Right-Click In iOS 11 Apple is replacing the JPEG image format with the new HEIC alternative. But what to do when device or p...
Free Better Battery Stats and Time Remaining for M... Better Battery Stats and Time Remaining for Mac OS TL;DR; Do you miss the time remaining indicator on your MacBook, MacBook Air, or MacBook Pro? He...
FAQ: Mac OS X Services HEIC to JPG on Right-Click Service Q: Where’d all my services go? I don’t see anything in the Services menu. A: If you don’t select anything before...
Translate Selected Text to English on Right Click ... TL;DR; Need instant translation right in context menu? You can accomplish it for free with one line of code in Automator, or you can proc...
Buy me a coffeeOut of coffee 😱, please help!