Support

Account

Home Forums Front-end Issues wp localize script and jquery Reply To: wp localize script and jquery

  • Hello,

    thanks for answer,

    I try now:

    
    function pw_load_scripts() {
    
            wp_register_script('pw-script', get_template_directory_uri() . '/assets/public/js/custom_filed.js', array('jquery'));
    	wp_localize_script('pw-script', 'pw_php_vars', array(
    			'custom_filed' => custom_filed
    		)
    	);
            wp_enqueue_script('pw-script');
            
     
    }
    add_action('wp_enqueue_scripts', 'pw_load_scripts');
    
    

    and still getting text custom_field instead of value. Is maybe problem with jquery?

    I try with append and html

    Thanks for help,

    A