Warning: call_user_func() expects parameter 1 to be a valid callback, #2387

add_action('woocommerce_after_add_to_cart_button', array( $this, 'ci_cart_text'), 10, 0 );

Warning: call_user_func() expects parameter 1 to be a valid callback, class ‘Ci_Simple_Features’ does not have a method ‘ci_cart_text’ in C:\xampp\htdocs\theme\wp-includes\class-wp-hook.php on line 285

Someone, please help

Thanks in advance

Could this possible be of help?

you might want to make sure you’ve loaded everything you think you’ve loaded.

Here my main template code

if ( in_array ( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', get_option ( 'active_plugins' )))){
	if ( !class_exists ( 'CI_Core' )){
     class CI_Core {
		 
		public function __construct(){
			
        // include class
		require( CI_PATH .'/inc/class-admin-settings.php');
		
		//Hooks 
		add_action('woocommerce_after_add_to_cart_button', array( $this, 'ci_cart_content_text '), 10, 0 );
	    }			
	 }
	 
	 $init = new CI_Core();
	 
	}		 
 }

Here my errors template code

if ( !class_exists( 'Ci_Cart_Text')) {
	class Ci_Cart_Text {
		public function ci_cart_content_text () {
               // for only test 
			echo 'Hello';
		}
	}
}

if you give me the best suggestion, then it will very help full.

Thanks again

These two things are not called the same name…

sorry for that
I have changed the function name
this is right public function ci_cart_content_text ()
please suggest me,

Thanks again

I am new in this section, so please do not mind
Give me the best suggestion

If you’ve changed it, is it still giving you the same error?

Yes
Thanks

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