79078785

Date: 2024-10-11 15:12:28
Score: 0.5
Natty:
Report link
    <?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.

Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (1):
Posted by: Finn Österreicher