Useful Snippets

Useful Snippets


This blog is used to collect useful snippets related to Linux, PHP, MySQL and more. Feel free to post comments with improvements or questions!

September 2020
M T W T F S S
 123456
78910111213
14151617181920
21222324252627
282930  

Categories


Disable preview in the WordPress theme Customizer

Stanislav KhromovStanislav Khromov

The WordPress Customizer preview can be notoriously buggy. Here is a snippet for easily disabling the customizer preview:

add_action( 'customize_preview_init', function() {
    die("The customizer is disabled. Please save and preview your site on the frontend.");
}, 1);

After adding this code to your themes functions.php file or a plugin, the live preview will simply show a message that it is disabled.

Screen Shot 2016-05-06 at 15.34.11

Web Developer at Aftonbladet (Schibsted Media Group)
Any opinions on this blog are my own and do not reflect the views of my employer.
LinkedIn
Twitter
WordPress.org Profile
Visit my other blog

Comments 0
There are currently no comments.