Use Redux Framework in wordpress functions.php

454 Views Asked by At

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...

1

There are 1 best solutions below

0
On BEST ANSWER

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 );