Skip to content

Instantly share code, notes, and snippets.

@brandonjp
Last active October 16, 2023 16:51
Show Gist options
  • Save brandonjp/13d7e26ad8cbc250b18a2262e46a447a to your computer and use it in GitHub Desktop.
Save brandonjp/13d7e26ad8cbc250b18a2262e46a447a to your computer and use it in GitHub Desktop.
this breaks code snippets pro - if either line 12 or 38 is removed, the snippet will save. But if both lines are present, an error is returned when saving: "Could not update snippet. Request failed with status code 418" - as of code_snippets_version: 3.5.1
if(!class_exists('WPOptionsViewPage')) {
class WPOptionsViewPage {
public function __construct() {
}
public function add_submenu_page() {
}
public function display_options_page() {
global $wpdb;
$options = $wpdb->get_results("SELECT * FROM {$wpdb->options} ORDER BY option_name ASC");
foreach($options as $option) {
}
echo '</ul></div>';
}
private function _iterate_data($data, $depth = 1) {
}
}
new WPOptionsViewPage();
add_action('admin_footer', 'wp_options_page_javascript');
function wp_options_page_javascript() {
echo '
<style>
.option-value { display: none; }
</style>
<script>
(function($) {
$(document).ready(function() {});
})(jQuery);
</script>
';
}
}
@sheabunge
Copy link

@brandonjp do you happen to use some sort of security software on your site like CloudFlare or mod_security?

@brandonjp
Copy link
Author

No CloudFlare and I don't have anything specifically customized. I'm just using Dreamhost standard shared hosting... I'll check on the mod_sec - stand by...... That Fixes It! Sweet blessed syntax! It's just a joy to see it working :)

Thank you @sheabunge However, is it a good idea to keep mod_security disabled?

For anyone else on Dreamhost, you can disabled the Web Application Firewall (WAF) in the panel at the bottom of a site's settings. Here's the help article: https://help.dreamhost.com/hc/en-us/articles/215947927

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment