Issue with a plugin that uses locate_template()

Hi,

I’m trying to use a plugin that is calling the following:

/**
 * @return string
 */
function template_include() {
	return locate_template( array( 'page.php', 'single.php', 'index.php' ) );
}

But because the theme passes everything through the blade files it just returns a white screen for the empty index.php.

Does anyone have any ideas on how to get around this?

I wonder if they have a hook at a higher level that could affect this. The locate_template function does not actually include any PHP template files by default. Since the $load argument defaults to false it should just be returning the template file path.

function locate_template( $template_names, $load = false, $require_once = true, $args = array() ) {
    ...

    if ( $load && '' !== $located ) {
        load_template( $located, $require_once, $args );
    }

    return $located;
}

Less ideal idea

If there are no better options, you can just mirror the plugin and make the change. If you’re deploying with bedrock then you could host it on a private repo. This should include some sort of auto-update and notifier for changes.

This topic was automatically closed after 42 days. New replies are no longer allowed.