Add a filter to install more url exclusions
-
I was looking at your code and found this:
/** * Get excluded urls regex. * * @since 7.0.0 * * @return string A regex for excluded urls. */ public function get_excluded_urls_regex() { // Get excluded urls. $parts = \get_option( 'siteground_optimizer_excluded_urls', array() ); $ecommerce_pages = array(); if ( class_exists( 'WooCommerce' ) ) { $ecommerce_pages[] = wc_get_cart_url(); $ecommerce_pages[] = wc_get_checkout_url(); $ecommerce_pages[] = get_permalink( get_option( 'woocommerce_myaccount_page_id' ) ) . '*'; } // Bail for ecommerce cart & checkout pages. if ( function_exists( 'edd_get_checkout_uri' ) ) { $ecommerce_pages[] = edd_get_checkout_uri(); }
Cool that you already have some compat with WC and EDD. I also want to add compatibility with Paid Memberships Pro and it would be easy as:
if ( function_exists( 'pmpro_url' ) ) { $ecommerce_pages[] = pmpro_url( 'levels' ); $ecommerce_pages[] = pmpro_url( 'checkout' ); $ecommerce_pages[] = pmpro_url( 'confirmation' ); $ecommerce_pages[] = pmpro_url( 'account' ); $ecommerce_pages[] = pmpro_url( 'billing' ); $ecommerce_pages[] = pmpro_url( 'invoice' ); $ecommerce_pages[] = pmpro_url( 'cancel' ); }
Otherwise, if you add a filter like
$ecommerce_pages = apply_filters( 'siteground_optimizer_excluded_ecommerce_pages', $ecommerce_pages );
Let us know,
Thanks!
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘Add a filter to install more url exclusions’ is closed to new replies.