Restore Old Database Over Newer WP & Plugin Files

Remember that the database contains content. And the wp-options table usually contains all of the settings of themes and plugins (although there might be other tables that a theme/plugin might use).

So the database contains content and settings that are used to display the page. The theme options contain the settings for the ‘look’ of the generated page. The plugins options contain settings that the plugin will use in their ‘part’ of the generated page.

The PHP files are the supporting files for the theme and plugins (and WP, of course).

The database contains entries (like Media) that include the URL of the media item, so if the domain name is changing, you may need to change (via a plugin like “Better Search and Replace”) the URLs in the database, plus the two entries in the wp_options table that contain the site URL.

Files aren’t really ‘extracted’ from the database. Content (and settings) are in the database. Files contain the code that queries the database (for content and settings) and ‘build’ the page.