Add option to disable menu caching

This commit is contained in:
Tetrakern 2024-09-19 21:56:59 +02:00
parent 63baa68a1a
commit 9425ae0458
4 changed files with 497 additions and 462 deletions

View File

@ -410,7 +410,7 @@ if ( ! defined( 'FICTIONEER_ENABLE_STORY_DATA_META_CACHE' ) ) {
// Boolean: Enable nav menu Transients
if ( ! defined( 'FICTIONEER_ENABLE_MENU_TRANSIENTS' ) ) {
define( 'FICTIONEER_ENABLE_MENU_TRANSIENTS', true );
define( 'FICTIONEER_ENABLE_MENU_TRANSIENTS', ! get_option( 'fictioneer_disable_menu_transients', false ) );
}
// Boolean: Order stories by last updated chapter timestamp

View File

@ -707,6 +707,12 @@ define( 'FICTIONEER_OPTIONS', array(
'group' => 'fictioneer-settings-general-group',
'sanitize_callback' => 'fictioneer_sanitize_checkbox',
'default' => 0
),
'fictioneer_disable_menu_transients' => array(
'name' => 'fictioneer_disable_menu_transients',
'group' => 'fictioneer-settings-general-group',
'sanitize_callback' => 'fictioneer_sanitize_checkbox',
'default' => 0
)
),
'integers' => array(
@ -1176,6 +1182,7 @@ function fictioneer_get_option_label( $option ) {
'fictioneer_allow_rest_save_actions' => __( 'Allow REST requests to trigger save actions', 'fictioneer' ),
'fictioneer_enable_global_splide' => __( 'Enable Splide slider globally', 'fictioneer' ),
'fictioneer_log_posts' => __( 'Log all post updates', 'fictioneer' ),
'fictioneer_disable_menu_transients' => __( 'Disable menu Transient caching', 'fictioneer' ),
);
}

View File

@ -1345,6 +1345,17 @@ $images = get_template_directory_uri() . '/img/documentation/';
?>
</div>
<div class="fictioneer-card__row">
<?php
fictioneer_settings_label_checkbox(
'fictioneer_disable_menu_transients',
__( 'Disable menu Transient caching', 'fictioneer' ),
__( 'Only do this if you render dynamic content in the menus.', 'fictioneer' ),
__( 'Compiling navigation menus is an extensive operation that involves multiple database queries. If you are not displaying dynamic content, such as points or other constantly changing data, it is best to cache the menus to avoid repeating the same queries for identical results.', 'fictioneer' )
);
?>
</div>
<div class="fictioneer-card__row">
<?php
fictioneer_settings_label_checkbox(

File diff suppressed because it is too large Load Diff