Skip to main content
added 36 characters in body
Source Link
cjbj
  • 15k
  • 16
  • 42
  • 89

You have to use like below:

function custom_register() { echo 'jQuery(document).ready(function(){alert("Learning Hooks");});';

} .

add_action('custom','custom_register'); // Too late - do_action was already called. do_action('custom'); // This is called before it will have an effect

function custom_register()
{
    echo '<script>jQuery(document).ready(function(){alert("Learning Hooks");});</script>';

}
.

add_action('custom','custom_register'); // Too late - do_action was already called. 
do_action('custom');                    // This is called before it will have an effect

You have to use like below:

function custom_register() { echo 'jQuery(document).ready(function(){alert("Learning Hooks");});';

} .

add_action('custom','custom_register'); // Too late - do_action was already called. do_action('custom'); // This is called before it will have an effect

You have to use like below:

function custom_register()
{
    echo '<script>jQuery(document).ready(function(){alert("Learning Hooks");});</script>';

}
.

add_action('custom','custom_register'); // Too late - do_action was already called. 
do_action('custom');                    // This is called before it will have an effect
Source Link

You have to use like below:

function custom_register() { echo 'jQuery(document).ready(function(){alert("Learning Hooks");});';

} .

add_action('custom','custom_register'); // Too late - do_action was already called. do_action('custom'); // This is called before it will have an effect