• Resolved skillatisw

    (@skillatisw)


    Hello

    Is there any way to remove the ?cli_action= in the url afther acceptance end page reload?

    Thank you

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author WebToffee

    (@webtoffee)

    Hi @skillatisw,

    We add it to refresh the page as an attempt to load the page without caching in case of cache implemented sites.

    Plugin Author WebToffee

    (@webtoffee)

    Hi @skillatisw,

    To disable cache flushing ( removes cli_action parameter from the URL ), please copy below code snippet to your active theme’s functions.php

    add_filter( 'wt_cli_enable_cache_flush', '__return_false');

    Make sure that you are using the latest version(1.8.8) of the plugin.

    Put this code to functions.php

    
    /**
     * Removes '?cli_action=1601400098.174' from url
     */
    function remove_cli_action_cookie_plugin() {
    
        if (isset( $_COOKIE[ 'viewed_cookie_policy' ] )) {
    
            ?>
            <script>
                function removeParam(key, sourceURL) {
                    var rtn = sourceURL.split("?")[0],
                            param,
                            params_arr = [],
                            queryString = (sourceURL.indexOf("?") !== -1) ? sourceURL.split("?")[1] : "";
                    if (queryString !== "") {
                        params_arr = queryString.split("&");
                        for (var i = params_arr.length - 1; i >= 0; i -= 1) {
                            param = params_arr[i].split("=")[0];
                            if (param === key) {
                                params_arr.splice(i, 1);
                            }
                        }
                        rtn = rtn + "?" + params_arr.join("&");
                    }
    
                    let length = rtn.length;
                    if (rtn.charAt(length - 1) === '?')
                        rtn = rtn.slice(0, length - 1);
    
                    return rtn;
                }
    
                currentUrl = window.location + '';
    
                window.history.pushState('hopcipiripi', null, removeParam('cli_action', currentUrl));
    
            </script>
            <?php
        }
    
    }
    
    add_action( 'wp_footer', 'remove_cli_action_cookie_plugin' );
    
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘How to eliminate ?cli_action= in urls’ is closed to new replies.