Plugin Directory


Ignore:
Timestamp:
10/13/2026 05:31:48 PM (3 weeks ago)
Author:
humanityco
Message:

Release 3.1.16 — simpler, more reliable privacy policy link; tested up to WordPress 7.1

File:
1 edited

Legend:

Unmodified
Added
Removed
  • cookie-notice/trunk/includes/settings.php

    r3731548 r3744556  
    24532453        /**
    24542454         * Point the WordPress privacy policy page at the banner's policy page, when synced.
     2455         * With no page chosen (id 0) the site's existing privacy page is kept, never cleared.
    24552456         *
    24562457         * @param array $options Full (merged) options
    … …  
    24582459         */
    24592460        public function sync_privacy_policy_page( $options ) {
    2460                 if ( $options['see_more_opt']['link_type'] === 'page' && $options['see_more_opt']['sync'] )
     2461                if ( $options['see_more_opt']['link_type'] === 'page' && $options['see_more_opt']['sync'] && (int) $options['see_more_opt']['id'] > 0 )
    24612462                        update_option( 'wp_page_for_privacy_policy', $options['see_more_opt']['id'] );
    24622463        }
    … …  
    24712472                if ( $options['see_more'] && $options['link_position'] === 'message' && strpos( $options['message_text'], '[cookies_policy_link' ) === false )
    24722473                        $options['message_text'] .= ' [cookies_policy_link]';
     2474                // Link position "banner": drop a bare trailing [cookies_policy_link] (left from "message" position; one the admin typed there is dropped too). Mid-message shortcodes and ones with attributes stay.
     2475                elseif ( $options['see_more'] && $options['link_position'] === 'banner' )
     2476                        $options['message_text'] = rtrim( preg_replace( '/ \[cookies_policy_link\]\s*$/', '', $options['message_text'] ) );
    24732477
    24742478                return $options;
Note: See TracChangeset for help on using the changeset viewer.