Make meta query options more convenient
They now execute all necessary follow-up actions on their own.
This commit is contained in:
parent
ac1771f1f8
commit
02168bfec1
@ -584,19 +584,19 @@ The theme’s CSS comes already minified and while additional optimizations such
|
||||
|
||||
### General Tab
|
||||
|
||||
Most of the theme’s configuration is found here, the options being largely self-explanatory. Please note that you will probably not need all the features available, such as Checkmarks or Follows. These are for sites with many authors or stories; publishing a weekly serial is better off saving the server resources. Some additional explanations:
|
||||
Most of the theme’s configuration is found here, the options being largely self-explanatory. Please note that you will probably not need all the features available, such as Checkmarks or Follows. These are for sites with many authors or stories; publishing a weekly serial is better off saving the server resources. Some options of note:
|
||||
|
||||
* **System Email Address/Name:** Used for no-reply transactional emails, such as comment reply notifications.
|
||||
* **Contact Form Receivers:** Submitted contact forms are sent to those email addresses. One per line.
|
||||
* **Add consent wrappers to embedded content:** Required to be GDPR compliant if you use embeds.
|
||||
* **Page Assignments:** Only set what you actually need. Used for breadcrumbs and menu items.
|
||||
* **Enable Storygraph API:** Allows external services to index and search your site to reach a larger audience. Recommended.
|
||||
* **Enable OAuth 2.0 authentication:** Allows visitors to register with social media accounts, but be aware of the implications!
|
||||
* **Enable OAuth 2.0 authentication:** Allows visitors to register with social media accounts, but be aware of the implications! You will need to flush your permalinks after enabling.
|
||||
* **Enable AJAX comment form/section:** If you have trouble with caching. Try the form first to save resources.
|
||||
* **Enable AJAX user authentication:** If you have trouble with [Nonces](https://developer.wordpress.org/apis/security/nonces/) and/or users not being properly logged-in. Use this as *last resort* to bypass the cache.
|
||||
* **Disable theme comment {…}:** If you want to use different comments. Disables most of the other comment options as well.
|
||||
* **Show story changelog button:** Opens modal with timestamped chapter changes; located under the chapter list.
|
||||
* **Disable extended story/chapter list meta queries:** Makes list pages and shortcodes load faster, but increases the size of your database. Safe if you do not have *thousands* of posts. Follow the instructions below the setting checkbox.
|
||||
* **Disable extended story/chapter list meta queries:** Makes list pages and shortcodes faster, but increases the size of your database by one row for each story/chapter. Fine unless you have thousands of posts.
|
||||
|
||||
### Roles Tab
|
||||
|
||||
|
@ -1052,9 +1052,9 @@ function fictioneer_register_settings() {
|
||||
* Validates the 'words per minute' setting with fallback
|
||||
*
|
||||
* @since 4.0.0
|
||||
* @see fictioneer_sanitize_integer()
|
||||
* @see fictioneer_sanitize_integer()
|
||||
*
|
||||
* @param int $input The input value to sanitize.
|
||||
* @param int $input The input value to sanitize.
|
||||
*
|
||||
* @return int The sanitized integer.
|
||||
*/
|
||||
@ -1067,9 +1067,9 @@ function fictioneer_validate_words_per_minute( $input ) {
|
||||
* Validates integer to be 1 or more
|
||||
*
|
||||
* @since 4.6.0
|
||||
* @see fictioneer_sanitize_integer()
|
||||
* @see fictioneer_sanitize_integer()
|
||||
*
|
||||
* @param int $input The input value to sanitize.
|
||||
* @param int $input The input value to sanitize.
|
||||
*
|
||||
* @return int The sanitized integer.
|
||||
*/
|
||||
@ -1083,7 +1083,7 @@ function fictioneer_validate_integer_one_up( $input ) {
|
||||
*
|
||||
* @since 4.6.0
|
||||
*
|
||||
* @param int $input The page ID to be sanitized.
|
||||
* @param int $input The page ID to be sanitized.
|
||||
*
|
||||
* @return int The sanitized page ID or -1 if not a page.
|
||||
*/
|
||||
@ -1096,9 +1096,9 @@ function fictioneer_validate_page_id( $input ) {
|
||||
* Validates an email address
|
||||
*
|
||||
* @since 4.6.0
|
||||
* @see sanitize_email()
|
||||
* @see sanitize_email()
|
||||
*
|
||||
* @param int $input The email address to be sanitized.
|
||||
* @param int $input The email address to be sanitized.
|
||||
*
|
||||
* @return string The email address if valid or an empty string if not.
|
||||
*/
|
||||
@ -1118,7 +1118,7 @@ function fictioneer_validate_email_address( $input ) {
|
||||
* @since 4.6.0
|
||||
* @see wp_kses_post()
|
||||
*
|
||||
* @param int $input The content for the cookie consent banner.
|
||||
* @param int $input The content for the cookie consent banner.
|
||||
*
|
||||
* @return string The sanitized content for the cookie consent banner.
|
||||
*/
|
||||
@ -1153,7 +1153,7 @@ function fictioneer_validate_phrase_cookie_consent_banner( $input ) {
|
||||
* @since 5.5.3
|
||||
* @link https://www.php.net/manual/en/function.filter-var.php
|
||||
*
|
||||
* @param string|boolean $value The checkbox value to be sanitized.
|
||||
* @param string|boolean $value The checkbox value to be sanitized.
|
||||
*
|
||||
* @return boolean True or false.
|
||||
*/
|
||||
@ -1179,7 +1179,7 @@ function fictioneer_sanitize_disable_widget_checkbox( $value ) {
|
||||
}
|
||||
|
||||
// =============================================================================
|
||||
// UPDATED HOOK ACTIONS
|
||||
// SANITIZE OPTION FILTERS
|
||||
// =============================================================================
|
||||
|
||||
add_filter( 'sanitize_option_fictioneer_user_profile_page', function( $new_value ) {
|
||||
@ -1238,4 +1238,56 @@ add_filter( 'sanitize_option_fictioneer_404_page', function( $new_value ) {
|
||||
return $new_value;
|
||||
}, 99);
|
||||
|
||||
// =============================================================================
|
||||
// UPDATED OPTION ACTIONS
|
||||
// =============================================================================
|
||||
|
||||
/**
|
||||
* Append missing 'fictioneer_story_hidden' if extended meta queries are disabled
|
||||
*
|
||||
* @since 5.9.4
|
||||
*
|
||||
* @param mixed $old_value The value before the update.
|
||||
* @param mixed $value The new value;
|
||||
*/
|
||||
|
||||
function fictioneer_update_option_disable_extended_story_list_meta_queries( $old_value, $value ) {
|
||||
if ( $value && $old_value !== $value ) {
|
||||
// Append 'fictioneer_story_hidden'
|
||||
fictioneer_append_meta_fields( 'fcn_story', 'fictioneer_story_hidden', 0 );
|
||||
|
||||
// Purge cache Transients
|
||||
fictioneer_delete_transients_like( 'fictioneer_' );
|
||||
}
|
||||
}
|
||||
add_action(
|
||||
'update_option_fictioneer_disable_extended_story_list_meta_queries', 'fictioneer_update_option_disable_extended_story_list_meta_queries',
|
||||
10,
|
||||
2
|
||||
);
|
||||
|
||||
/**
|
||||
* Append missing 'fictioneer_chapter_hidden' if extended meta queries are disabled
|
||||
*
|
||||
* @since 5.9.4
|
||||
*
|
||||
* @param mixed $old_value The value before the update.
|
||||
* @param mixed $value The new value;
|
||||
*/
|
||||
|
||||
function fictioneer_update_option_disable_extended_chapter_list_meta_queries( $old_value, $value ) {
|
||||
if ( $value && $old_value !== $value ) {
|
||||
// Append 'fictioneer_chapter_hidden'
|
||||
fictioneer_append_meta_fields( 'fcn_chapter', 'fictioneer_chapter_hidden', 0 );
|
||||
|
||||
// Purge cache Transients
|
||||
fictioneer_delete_transients_like( 'fictioneer_' );
|
||||
}
|
||||
}
|
||||
add_action(
|
||||
'update_option_fictioneer_disable_extended_chapter_list_meta_queries', 'fictioneer_update_option_disable_extended_chapter_list_meta_queries',
|
||||
10,
|
||||
2
|
||||
);
|
||||
|
||||
?>
|
||||
|
@ -723,7 +723,7 @@
|
||||
<?php
|
||||
fictioneer_settings_label_checkbox(
|
||||
'fictioneer_disable_extended_story_list_meta_queries',
|
||||
__( 'Faster, but increases your database. Use <strong>[Story Hidden]</strong> and <strong>[Purge Theme Caches]</strong> under <strong>Tools</strong> afterwards.', 'fictioneer' )
|
||||
__( 'Faster, but adds rows to your database, which can slow down your site if you have thousands of posts.', 'fictioneer' )
|
||||
);
|
||||
?>
|
||||
</div>
|
||||
@ -732,7 +732,7 @@
|
||||
<?php
|
||||
fictioneer_settings_label_checkbox(
|
||||
'fictioneer_disable_extended_chapter_list_meta_queries',
|
||||
__( 'Faster, but increases your database. Use <strong>[Chapter Hidden]</strong> and <strong>[Purge Theme Caches]</strong> under <strong>Tools</strong> afterwards.', 'fictioneer' )
|
||||
__( 'Faster, but adds rows to your database, which can slow down your site if you have thousands of posts.', 'fictioneer' )
|
||||
);
|
||||
?>
|
||||
</div>
|
||||
|
Loading…
x
Reference in New Issue
Block a user