diff --git a/includes/config.php b/includes/config.php index bdf1bf5..7699e3f 100644 --- a/includes/config.php +++ b/includes/config.php @@ -420,8 +420,8 @@ function define_customizer_fields( $wp_customize ) { /** * Disable comments and trackbacks/pingbacks on this site. **/ -update_option( 'default_ping_status', 'off' ); -update_option( 'default_comment_status', 'off' ); +force_option_value( 'default_ping_status', 'off' ); +force_option_value( 'default_comment_status', 'off' ); /** diff --git a/includes/meta.php b/includes/meta.php index 2b14cef..b69c41c 100644 --- a/includes/meta.php +++ b/includes/meta.php @@ -176,5 +176,5 @@ function colleges_post_list_js_deps( $deps ) { add_filter( 'ucf_post_list_js_deps', 'colleges_post_list_js_deps', 10, 1 ); -update_option( 'ucf_post_list_include_js_libs', false ); -update_option( 'ucf_degree_search_include_typeahead', false ); +force_option_value( 'ucf_post_list_include_js_libs', false ); +force_option_value( 'ucf_degree_search_include_typeahead', false ); diff --git a/includes/utilities.php b/includes/utilities.php index 46362bd..7f77356 100644 --- a/includes/utilities.php +++ b/includes/utilities.php @@ -47,7 +47,6 @@ function get_theme_mod_or_default( $theme_mod ) { } - /** * Utility function that returns an image url by its thumbnail size. **/ @@ -58,3 +57,14 @@ function get_attachment_src_by_size( $id, $size ) { } return $attachment; } + + +/** + * Checks if a given option is set to the provided value, and updates it + * if it is not + */ +function force_option_value( $option, $value ) { + if ( get_option( $option ) !== $value ) { + update_option( $option, $value ); + } +}