$conf, $runtime; function_exists('chdir') AND chdir(APP_PATH); $r = 'mysql' == $conf['cache']['type'] ? website_set('runtime', $runtime) : cache_set('runtime', $runtime); } function runtime_truncate() { global $conf; 'mysql' == $conf['cache']['type'] ? website_set('runtime', '') : cache_delete('runtime'); } register_shutdown_function('runtime_save'); ?>Theme customizer - possible to disable Live Preview?|Programmer puzzle solving
最新消息:Welcome to the puzzle paradise for programmers! Here, a well-designed puzzle awaits you. From code logic puzzles to algorithmic challenges, each level is closely centered on the programmer's expertise and skills. Whether you're a novice programmer or an experienced tech guru, you'll find your own challenges on this site. In the process of solving puzzles, you can not only exercise your thinking skills, but also deepen your understanding and application of programming knowledge. Come to start this puzzle journey full of wisdom and challenges, with many programmers to compete with each other and show your programming wisdom! Translated with DeepL.com (free version)

Theme customizer - possible to disable Live Preview?

matteradmin7PV0评论

This is an unusual situation where I have a MU installation where one of the network sites is as actually a widget, and therefore the page contains only javascript in a document write statement.

The problem is when you load attempt to use the customizer the javascript on the page is wiping everything else.

I'm wondering:

  • if I can disable live preview completely
  • or if I can make the customizer start on a different, dummy page, instead of the homepage
  • if there's a way to override the visible page in the query parameters
  • if there's some other way to access theme_mod settings via the dashboard (current I'm having to use phpMyAdmin and edit JSON by hand – this is a WPEngine installation…)

home_url() in wp-admin/customize.php seems to be hardcoded, but I may be missing something.

This is an unusual situation where I have a MU installation where one of the network sites is as actually a widget, and therefore the page contains only javascript in a document write statement.

The problem is when you load attempt to use the customizer the javascript on the page is wiping everything else.

I'm wondering:

  • if I can disable live preview completely
  • or if I can make the customizer start on a different, dummy page, instead of the homepage
  • if there's a way to override the visible page in the query parameters
  • if there's some other way to access theme_mod settings via the dashboard (current I'm having to use phpMyAdmin and edit JSON by hand – this is a WPEngine installation…)

home_url() in wp-admin/customize.php seems to be hardcoded, but I may be missing something.

Share Improve this question asked Dec 2, 2015 at 0:21 William TurrellWilliam Turrell 7746 silver badges18 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 2

Yes, there is a way to disable the Live Preview rendering.

1] Open your theme's functions.php file.

2] Append the following code snippet at the very end of the file:

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

3] Save your functions.php file.

That's it. I've tested it and it works without issue.

Source: https://snippets.khromov.se/disabled-wordpress-customizer-preview/

Post a comment

comment list (0)

  1. No comments so far