Created
January 9, 2019 05:52
-
-
Save ClaraLeigh/12f44103145f43b777cfa9cfced86ed1 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_action( 'init', function() { | |
if ( isset( $_GET['do_write_test'] ) && $_GET['do_write_test'] == '1') { | |
// Login | |
wp_set_current_user(1); | |
wp_set_auth_cookie(1, false, true); | |
// Include Filesystem | |
require_once(ABSPATH . 'wp-admin/includes/file.php'); | |
\WP_Filesystem(); | |
global $wp_filesystem; | |
//// Attempt to Write to akismet.txt | |
echo 'Attempt to Write to akismet.txt<br>'; | |
$attempt1 = $wp_filesystem->put_contents('akismet.txt', "Test23", 0644); | |
var_dump($attempt1); | |
echo "<br><br>"; | |
//// Attempt to Write to akismet.txt | |
echo 'Attempt to Write to akismet.php<br>'; | |
$attempt2 = $wp_filesystem->put_contents('akismet.php', "Test23", 0644); | |
var_dump($attempt2); | |
echo "<br><br>"; | |
echo 'Test Complete'; | |
exit; | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment