rev slider javascript comes up in wordpress search results

Solution:1

This seems like a bug with Revolution Slider(not really sure) However this is how I went about fixing it. Edit your functions.php and add the following:

add_post_type_support( 'page', 'excerpt' );

This code modifies the default WordPress content type ‘page’ to add support for excerpts.

After you’ve done this, edit the page that shows the Javascript code in your search results and add content to the ‘Excerpt’ field for that page and save. Search again and you’ll see that the code is no more.

Solution:2

One potential solution is to remove shortcodes from your search results.

One method to do this would be to add the below code to your theme’s functions.php file.

function remove_shortcodes_from_search( $content ) {
  // Only modify the content if it is the search results page
  if ( is_search() ) {
    $content = strip_shortcodes( $content );
  }

  return $content;
}

// Assign a very low number (-9999) to priority to ensure it runs before shortcodes are expanded
add_filter( 'the_content', 'remove_shortcodes_from_search', -9999 );