Get post meta in enqueued js file
You can send variables to your script with wp_localize_script: wp_enqueue_script( ‘some_handle’ ); global $post; $my_meta = get_post_meta( $post->ID, ‘my_meta’, true ); $array = array( ‘my_meta’ => $my_meta ); wp_localize_script( ‘some_handle’, ‘object_name’, $array ); You can then use the var in your script like: object_name.my_meta