Hwo to turn off “get_parent_theme_file_path” in child-theme?

If you look at get_parent_theme_file_path() it returns apply_filters( 'parent_theme_file_path', $path, $file );
You need to add a filter here to override the location to something in your child theme, like so.

add_filter('parent_theme_file_path', function($path, $file) {
    if ($file !== '/inc/icon-functions.php') {
        return $path;
    }

    $path = get_stylesheet_directory() . "https://wordpress.stackexchange.com/" . $file;

    return $path;
}, 10, 2);

You will still need to have a file for it to find at that location in your child theme, but you can put whatever you want in there.

Leave a Comment