PHP Override Plugin File Path In Child Theme


#1

I’ve created a child class in my child theme to override a parent class from a plugin but it duplicates some data.

<?php
class Child_Class extends Parent_Class {

    function form_metabox() {
	
	include get_stylesheet_directory() . '/form-metabox.php';

	
    }

}

$new = Child_Class();

All i changed was this line from this in the plugins parent class


include( dirname( __FILE__ ) . '/form-metabox.php' );

To this in the child themes child class


include_once get_stylesheet_directory() . '/form-metabox.php';