You can’t just filter __FILE__
. Or any arbitrary function or variable. You can only filter values that are passed to apply_filters()
. In this case the wcpv_vendor_order_page_template
filterable value is:
dirname( __FILE__ ) . '/views/html-vendor-order-page.php'
In other words, it’s a path to a PHP file. If you want to change the PHP file that’s loaded, you can filter wcpv_vendor_order_page_template
to pass the path to a file in your theme.
So if you create a version of this file in wp-content/{yourtheme}/wcpv//views/html-vendor-order-page.php
, you can make the plugin load that version like this:
add_filter(
'wcpv_vendor_order_page_template',
function( $path ) {
return get_theme_file_path( 'wcpv//views/html-vendor-order-page.php' );
}
);