Created
January 19, 2024 18:23
-
-
Save tflight/95f7f8f537f422dc649effc294bab473 to your computer and use it in GitHub Desktop.
ACF Escape HTML Log Check
This file contains 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
<?php | |
/** | |
* Plugin Name: ACF Escape HTML Log Check | |
* Description: Checks if the ACF Escape HTML Log has been triggered. | |
* Version: 1.0.0 | |
* Requires at least: 6.0 | |
* Requires PHP: 7.4 | |
* Author: Tim Flight | |
* Author URI: https://github.com/tflight | |
* License: MIT | |
* | |
*/ | |
if (! defined('ABSPATH')) { | |
exit('No direct script access allowed'); | |
} | |
if (defined('WP_CLI') && WP_CLI) { | |
WP_CLI::add_command('tflight acf-log-check', 'tflight_acf_log_check', [ | |
'shortdesc' => 'Checks if the ACF Escape HTML Log has been triggered.' | |
]); | |
} | |
function tflight_acf_log_check() | |
{ | |
$logs = get_option('acf_will_escape_html_log'); | |
if ($logs === false) { | |
WP_CLI::success('No log entries found.'); | |
return; | |
} | |
WP_CLI::warning("ACF Escape HTML Log Check entries found."); | |
foreach ($logs as $field => $log) { | |
WP_CLI::log("\n" . '# ' . $field); | |
$theFields = [$log]; | |
WP_CLI\Utils\format_items('table', $theFields, ['selector', 'function', 'field', 'post_id']); | |
} | |
WP_CLI::log("\n" . 'After addressing the issue, reset with `wp option delete acf_will_escape_html_log`'); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment