Fatal error: Uncaught Error: Call to undefined function get_home_path()
-
I’ve taken some custom SiteOrigin Page Builder widgets out of a theme and placed them in a new custom plugin.
In the main plugin file, I have:
require plugin_dir_url( __FILE__ ) . 'hdr003.php'; require plugin_dir_url( __FILE__ ) . 'hme006.php'; require plugin_dir_url( __FILE__ ) . 'hme007.php'; function purity_register_widgets(){ register_widget('ICD_HDR003_Widget'); register_widget('ICD_HME006_Widget'); register_widget('ICD_HME007_Widget'); } add_action( 'widgets_init', 'purity_register_widgets');In, for example, hdr003.php, I have:
class ICD_HDR003_Widget extends WP_Widget {However, I receive:
Fatal error: Class ‘WP_Widget’ not found
Hence, I’m trying to include in hdr003.php:
require_once(get_home_path(). 'wp-includes/class-wp-widget.php');but this produces an error:
Fatal error: Uncaught Error: Call to undefined function get_home_path()
The function is a valid function.
If I replace that line with:
require_once(ABSPATH . 'wp-includes/class-wp-widget.php');I receive:
include_once(ABSPATH/wp-includes/class-wp-widget.php): failed to open stream: No such file or directory
The file /wp-includes/class-wp-widget.php exists.
I’ve replaced /wp-admin & /wp-includes with newly downloaded copies.
Help appreciated.
The topic ‘Fatal error: Uncaught Error: Call to undefined function get_home_path()’ is closed to new replies.