Created
September 3, 2020 23:01
-
-
Save shawnhooper/2e800d719916c47c7976deedf4d91c48 to your computer and use it in GitHub Desktop.
WordPress - Disable saving in the customizer
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 | |
/** Add this to the bottom of your functions.php file in your theme **/ | |
require_once ABSPATH . WPINC . '/class-wp-customize-manager.php'; | |
remove_action('wp_ajax_customize_save', array($GLOBALS['wp_customize'], 'save')); | |
add_action('wp_ajax_customize_save', 'return_403_on_customizer_save'); | |
function return_403_on_customizer_save() { | |
wp_send_json(array('message' => 'Theme Editor in Read Only Mode'), 403); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment