WordPress Errors in generated by theme check plugin [closed]

File operations should use the WP_Filesystem methods instead of direct PHP filesystem calls.

The WordPress coding styles require that you make use of the WP Filesystem instead of using direct PHP file functions. You can replace your file_get_contents call easily with:

$response = wp_remote_get($feed_url);
$file_content = $response['body'];

For more specific infos just take a look at: “A Look at the WordPress HTTP API: A Practical Example of wp_remote_get“.

If the file you want to read is not a local file, then please refer to the WordPress Filesystem_API.

Leave a Comment