1

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

$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

closed as off-topic by Nicolai, Chip Bennett, gmazzap, fuxia Apr 14 '14 at 0:25

This question appears to be off-topic. The users who voted to close gave this specific reason:

If this question can be reworded to fit the rules in the help center, please edit the question.

  • Passing a variable by reference on the function call was removed in php 5.4 (you add it in the function definition now). WordPress dies silently oftentimes, so it's loading, but you're just causing a php fatal error. – Andrew Bartel Apr 13 '14 at 21:16
  • 1
    This is a PHP issue, that merely happens in the context of WordPress. – Chip Bennett Apr 13 '14 at 21:46
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 );

Not the answer you're looking for? Browse other questions tagged or ask your own question.