WordPress function not working when GD Star Rating is active

This is my error:

Warning: call_user_func_array() [function.call-user-func-array]: First argument is expected to be a valid callback, 'my_scripts_method_2' was given in /home/www/domain.com/wp-includes/plugin.php on line 406

This is the function giving the error:

Read More
add_action('wp_enqueue_scripts', 'my_scripts_method_2');
function catch_that_image() {
  global $post, $posts;
  $first_img = '';
  ob_start();
  ob_end_clean();
  $output = preg_match_all('/<img.+src=['"]([^'"]+)['"].*>/i', $post->post_content, $matches);
  $first_img = $matches [1] [0];
  if(empty($first_img)){ //Defines a default image
    $first_img = "http://domain.com/wp-content/uploads/2013/07/billede.jpg";
  }
  return $first_img;
}

I only get the error when GD star rating is enabled. Also, the problem is not likely to be that ‘my_scripts_method_2 is already in use. I changed the name various times, still gives the error.

Related posts

Leave a Reply