Get rid of this Strict Standards warning

I’m trying to get rid of this warning from my wordpress installation.
Strict Standards: Only variables should be passed by reference in xxxxx on line 67

The line with the “faulty code” is this one

Read More
$wp_theme_name = next(explode('/themes/', $stylesheet_directory_uri));

However, if I do pass the value per reference as requested, the WP doesn’t load anymore.

Can you please help me to understand how to fix this?

Thanks
Andrea

Related posts

Leave a Reply

1 comment

  1. This occurs because you do the explode() call inside the next() call. The reason I think is, by strict standards you shouldn’t pass a function to a function like this, because, like @AndrewBartel said, of reference, which would be missing. Doing it like shown below should work and would be correct:

    $nval = explode( '/themes/', $stylesheet_directory_uri );
    $wp_theme_name = next( $nval );