How can I determine what php files are being called by a given WP page?

There’s a native PHP function get_included_files() for that.

Simply attach it to an action on the hook from where you want to know it. The first one is muplugins_loaded and the last accessible on is shutdown.

add_action( 'muplugins_loaded', function()
{
    $files = get_included_files();
    foreach ( $files as $f )
        echo $f.'<br>';

    // or...
    var_dump( $files );
}

Leave a Comment