Search code examples
wordpressframeworksredux-framework

Use Redux Framework in wordpress functions.php


I want to use some redux framework options in wordpress functions.php but i does not work.

my functions.php:

<?php
global $redux_options;

if ($redux_options['remove_par'] == '1' ) {
    function vc_remove_wp_ver_css_js( $src ) {
        if ( strpos( $src, 'ver=' ) )
            $src = remove_query_arg( 'ver', $src );
        return $src;
    }
    add_filter( 'style_loader_src', 'vc_remove_wp_ver_css_js', 9999 );
    add_filter( 'script_loader_src', 'vc_remove_wp_ver_css_js', 9999 );
}    
?>

Thank you in advance...


Solution

  • Here is the solution: Put global var in function.

    function vc_remove_wp_ver_css_js( $src ) {
        global $redux_options;
    
        if ( $redux_options['remove_par'] !== '1' ) {
            return;
        }
    
        if ( strpos( $src, 'ver=' ) )
            $src = remove_query_arg( 'ver', $src );
        return $src;
    }
    add_filter( 'style_loader_src', 'vc_remove_wp_ver_css_js', 9999 );
    add_filter( 'script_loader_src', 'vc_remove_wp_ver_css_js', 9999 );