Created
August 12, 2019 10:22
-
-
Save zevilz/70598baa0fc23ac9f33783ab54595b75 to your computer and use it in GitHub Desktop.
Function for get cached carbon fields option or get it if it not isset in cache
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Gets cached carbon fields option or get it if it not isset in cache | |
* | |
* @param string $option Option name | |
* | |
* @return mixed | |
*/ | |
function carbon_get_theme_option_cached( $option ) { | |
$option_value = wp_cache_get( $option, 'crb_options' ); | |
if ( false === $option_value ) { | |
$option_value = carbon_get_theme_option( $option ); | |
wp_cache_set( $option, $option_value, 'crb_options' ); | |
} | |
return $option_value; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment