WordPress - WP_Filesystem does not write or read
<p>On my server the WP_Filesystem does not work.
If I use the standard <code>file_put_contents</code> and <code>file_get_contents</code> the files are read and written just normally.</p>

<p>Do you know what may be the issue?</p>

<p>THIS DOES NOT WORK (RETURNING NO ERRORS):</p>

<pre><code>global $wp_filesystem;
// Initialize the WP filesystem, no more using 'file-put-contents' function
if (empty($wp_filesystem)) {
    require_once (ABSPATH . '/wp-admin/includes/file.php');
    WP_Filesystem();
}

if(!$wp_filesystem-&gt;put_contents( $path, $file_contents, 0644) ) {
    return esc_html__('Failed to put file', 'magellan');
}
</code></pre>

<p>THIS WORKS:</p>

<pre><code>file_put_contents($path, $file_contents);       
</code></pre>