cache get_current_page_url

This commit is contained in:
Mike Jolley 2019-01-30 13:11:09 +00:00
parent d167cb0a95
commit 536d71a5f6
1 changed files with 7 additions and 0 deletions

View File

@ -289,6 +289,13 @@ abstract class WC_Widget extends WP_Widget {
* @since 3.3.0
*/
protected function get_current_page_url() {
$cache_key = 'woocommerce_widget_get_current_page_url';
$cached_value = (string) wp_cache_get( $cache_key, 'woocommerce' );
if ( $cached_value ) {
return apply_filters( 'woocommerce_widget_get_current_page_url', $cached_value, $this );
}
if ( defined( 'SHOP_IS_ON_FRONT' ) ) {
$link = home_url();
} elseif ( is_shop() ) {