<?php
// Check if the Wordfence class and method exist
if (class_exists('wordfence') && method_exists('wordfence', 'importSettings')) {
// Provide the token for importing settings
$token = file_get_contents('/Websites/wordpress-setup/wordfence-token.txt');
if ($token) {
$result = wordfence::importSettings($token);
if ($result) {
echo "Wordfence settings imported successfully.\n";
} else {
echo "Failed to import Wordfence settings.\n";
}
} else {
echo "Wordfence settings token not found or could not be read.\n";
}
} else {
echo "Wordfence importSettings method not available.\n";
exit(1);
}
That fixes the issue for the wordfence settings when being run in the wp-site folder.