0

So i am localizing data saved in an array for my plugin's options, however the data is only localized in the front end, how can I localize data in the plugin's option page as well?

The following is what I use to print the data in the front end to be used by my jquery script,

/* localize array data */
    $data = get_option('lu_ban_data'); 
    wp_localize_script( 'lu_ban', 'lu_ban_object', $data);
1

Maybe I am missing the point but assuming that a script is enqueued with the lu_ban slug...

function add_data_admin_wpse_112178() {
    $data = get_option('lu_ban_data');
    wp_localize_script( 'lu_ban', 'lu_ban_object', $data);
}
add_action('admin_enqueue_scripts','add_data_admin_wpse_112178');

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.