diff --git a/lib/custom-fields/custom-js-field.php b/lib/custom-fields/custom-js-field.php
index 43bfcc967..e9dd30274 100644
--- a/lib/custom-fields/custom-js-field.php
+++ b/lib/custom-fields/custom-js-field.php
@@ -40,14 +40,11 @@ function custom_js_custom_box_save_data($post_id) {
if ( !function_exists( 'insert_custom_js' ) ):
function insert_custom_js() {
if ( is_singular() ) {
- if ( have_posts() ) : while ( have_posts() ) : the_post();
- $custom_js = get_post_meta(get_the_ID(), '_custom_js', true) ;
- if ($custom_js) {
- echo ''.PHP_EOL;
- echo ''.PHP_EOL;
- }
- endwhile; endif;
- rewind_posts();
+ $custom_js = get_post_meta(get_the_ID(), '_custom_js', true);
+ if ($custom_js) {
+ echo ''.PHP_EOL;
+ echo ''.PHP_EOL;
+ }
}
}
endif;