I'm using the PHP
file_get_contents() function to retrieve and echo the contents of an SVG-file.
<?php echo file_get_contents( get_stylesheet_directory_uri() . '/assets/images/Search_Glyph.svg' ); ?>
I checked the theme with the Wordpress.org theme checker and I am currently resolving all the issues. One of the issues is the use of
It gives me the following warning:
WARNING: file_get_contents was found in the file header.php File operations should use the WP_Filesystem methods instead of direct PHP filesystem calls.
I tried finding information about the
$wp_filesystem thing, but there is very little information available and even less examples (to be honest, I'm not totally sure if that's the correct function to use).
How can I use a Wordpress function to retrieve a file and echo the contents of it in a PHP-file?
I'm really at loss what I should do with this. All help is very much appreciated!