Error within the Child Theme

Hello!

I need help with the following issue. [My website is crisisequipped.com.]

We are getting the following error frequently:

[23-Dec-2020 01:15:40 UTC] PHP Warning: call_user_func_array() expects parameter 1 to be a valid callback, function ‘my_script’ not found or invalid function name in /home3/crisise1/public_html/wp-includes/class-wp-hook.php on line 287

Upon further research, we believe the function “my_script” is referenced in x Child theme

This seems to be the bit of code responsible:

…add_action (‘wp_head’, ‘my_script’, 9999); …


After doing a string search, we found the error is located here:

wp-content/themes/x-child/functions.php line 242 char: 24


It is part of the following function:


function gw_footer_enqueue() {

//if ( is_page( 178 ) ) {

wp_enqueue_script( ‘custom_script’, get_stylesheet_directory_uri() . ‘/custom_script.js’, array(), ‘jsb’.time(), true);

//}

}

add_action( ‘wp_enqueue_scripts’, ‘gw_footer_enqueue’ );

add_action (‘wp_head’, ‘my_script’, 9999);


page 178 is the ID of our /blog page that contains all of our blog posts.

Do you have any insight into this error?
Thanks so much!

Hello Nadia,

Thanks for writing to us.

It would require custom development to fix the child theme issue I would suggest you contact a developer who can assist you with your concern. Please note that we don’t provide any custom development support and customized child theme support. It is out of the support scope.

Thanks for understanding

Hello!

Yes, my website developer is the one that found the errors. He wants to know if you can provide any insight into the errors he found since the child theme is from X theme.

I’m not asking for your support team to fix the errors- my developer will do that. All I’m asking is if you can provide more insight or information on what he found so that he is able to fix them for me.

Thanks for your time and help!
Nadia

Hi Nadia,

Unfortunately, as per our support policies, we can’t provide support or investigation to the modified child-theme or related issues. Still, I would suggest your developer go through the following article, which may help.

  1. https://developer.wordpress.org/reference/functions/wp_enqueue_script/
  2. https://codex.wordpress.org/Conditional_Tags

Thanks for understanding.

Ok, thanks

No problem, Nadia. :slight_smile:

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.