Title: Improper exclude url merging
Last modified: January 7, 2021

---

# Improper exclude url merging

 *  [hitkodev](https://wordpress.org/support/users/hitkodev/)
 * (@hitkodev)
 * [5 years, 7 months ago](https://wordpress.org/support/topic/improper-exclude-url-merging/)
 * In `inc/cache/config-cache.php`, `write_config_cache` always overrides exclude
   urls instead of merging them. Basically each `array_merge` call should also include`
   $storage['exclude_url']`, otherwise exclude urls from FB plugin override exclude
   urls from Woocommerce.

Viewing 3 replies - 1 through 3 (of 3 total)

 *  Thread Starter [hitkodev](https://wordpress.org/support/users/hitkodev/)
 * (@hitkodev)
 * [5 years, 7 months ago](https://wordpress.org/support/topic/improper-exclude-url-merging/#post-13878214)
 * Here’s a fixed version: [https://pastebin.com/5qMrT3KW](https://pastebin.com/5qMrT3KW)
 *  Plugin Author [adeelkhan](https://wordpress.org/support/users/adeelkhan/)
 * (@adeelkhan)
 * [5 years, 7 months ago](https://wordpress.org/support/topic/improper-exclude-url-merging/#post-13897839)
 * Could you please explain the use case of overridden exclude URLs?
 *  Thread Starter [hitkodev](https://wordpress.org/support/users/hitkodev/)
 * (@hitkodev)
 * [5 years, 5 months ago](https://wordpress.org/support/topic/improper-exclude-url-merging/#post-14175333)
 * I believe it should be plenty obvious from the code. Let’s go step by step through
   the affected code, shall we?
 *     ```
               $storage['exclude_url'] = array_merge(
       			$ecommerce_exclude_urls,
       			! empty( $config['breeze-exclude-urls'] ) ? $config['breeze-exclude-urls'] : array()
       		);
       ```
   
 * This part merges `$ecommerce_exclude_urls` and exclude urls from config and stores
   them to `$storage['exclude_url']`. So far so good, your code works. Next code:
 *     ```
       $saved_pages = get_option( 'breeze_exclude_url_pages', array() );
   
       	    if ( ! empty( $saved_pages ) ) {
       		    $saved_pages_urls = array();
       		    foreach ( $saved_pages as $page_id ) {
       			    $saved_pages_urls[] = get_permalink( $page_id );
       		    }
   
       		    $saved_pages_urls = array_unique( $saved_pages_urls );
   
       		    $storage['exclude_url'] = array_merge(
       			    $saved_pages_urls,
       			    ! empty( $config['breeze-exclude-urls'] ) ? $config['breeze-exclude-urls'] : array()
       		    );
       	    }
       ```
   
 * Now if you look what this does is if `$saved_pages` option is set, it merges `
   $saved_pages_urls` and exclude urls form the config, and stores them to `$storage['
   exclude_url']`. Now tell me, what happened to `$ecommerce_exclude_urls` which
   were added to `$storage['exclude_url']` in the previous step? They just got overridden
   by `$saved_pages_urls`. But what’s this? More code?
 *     ```
       if( class_exists('WC_Facebook_Loader')){
       		    $woocommerce_fb_feed_link = Breeze_Ecommerce_Cache::factory()->wc_facebook_feed();
   
       		    if(!empty($woocommerce_fb_feed_link)){
       			    $storage['exclude_url'] = array_merge(
       				    $woocommerce_fb_feed_link,
       				    ! empty( $config['breeze-exclude-urls'] ) ? $config['breeze-exclude-urls'] : array()
       			    );
       		    }
       	    }
       ```
   
 * See the pattern? Now if `WC_Facebook_Loader` is active, we again override any
   saved or ecommerce urls from the previous step. Amazing.
    -  This reply was modified 5 years, 5 months ago by [hitkodev](https://wordpress.org/support/users/hitkodev/).

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Improper exclude url merging’ is closed to new replies.

 * ![](https://ps.w.org/breeze/assets/icon-256x256.gif?rev=3352595)
 * [Breeze Cache](https://wordpress.org/plugins/breeze/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/breeze/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/breeze/)
 * [Active Topics](https://wordpress.org/support/plugin/breeze/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/breeze/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/breeze/reviews/)

 * 3 replies
 * 2 participants
 * Last reply from: [hitkodev](https://wordpress.org/support/users/hitkodev/)
 * Last activity: [5 years, 5 months ago](https://wordpress.org/support/topic/improper-exclude-url-merging/#post-14175333)
 * Status: not resolved