• scatory2

    (@scatory2)


    Debugging a custom WP theme and trying to update to WordPress 6 and PHP 8. Keep getting this error

    Fatal error: Uncaught Error: Non-static method globals::getInstance() cannot be called statically in…functions.php

    Here is the code block in question from my functions.php

    function get_resource_cat_ids(){ 
    	$IDArray = array(); 
    	$resources_id = globals::getInstance()->resources_id; 
    	$categories = get_categories(  array( 'parent' => $resources_id ) ); 
    	foreach($categories as $cat) {    
    		array_push($IDArray, $cat->term_id);	 
    	} 	
    	array_push($IDArray, $resources_id);
    	return $IDArray;
    }
Viewing 2 replies - 1 through 2 (of 2 total)
  • Alan Fuller

    (@alanfuller)

    Can you get the stack trace of that call to getInstance?

    If you set WP into debug mode with debug log it should give you the full stack.

    Kaavya Iyer

    (@kaavyaiyer)

    Hi @scatory2,

    If possible, can you please share the function definition of getInstance()?

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Uncaught Error: Non-static method globals::getInstance() cannot be called static’ is closed to new replies.