Created
April 11, 2013 08:53
-
-
Save jdevalk/5361844 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// If you have a function with a default argument: | |
function bla ( $echo = true ) { | |
if ( !$echo ) | |
return 'bla'; | |
else | |
echo 'bla'; | |
} | |
// And you then hook this function: | |
add_action( 'wp_head', 'bla' ); | |
// $echo remains unset and thus !$echo == true and the function returns instead of echos... | |
// Solutiuon, of course, is to change | |
if ( !$echo ) | |
return 'bla'; | |
// Into | |
if ( $echo === false ) | |
return 'bla'; | |
// But it takes some debugging to get there :) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
By default, wp_head() does nothing but call do_action('wp_head')
It's probably bad form, but if -in your template- you replace:
wp_head();
with:
do_action('wp_head', true);
Your parameter will be passed.