I'm asking about the relation of WP .php files (themes etc.) with the database. Is (part of) the content of these files stored in any way on the database?

Context: I'm trying to migrate from http to https. All the relevant guides, talk exclusively about a "Search and Replace" of the http://domain with the https://domain in the database. Nowhere did I find anyone mention that you should also do a search and replace in the theme or other .php files of WP; though often there are links/references to the domain in these files.

1 Answer 1


No, a theme's .php files are not stored in the database. Themes should not be hardcoding URLs in their files. However, it's totally possible for this to happen, particularly with a custom theme or plugins whose developer did not follow best practices.

I'd suggest using a search utility such as grep (grepwin is nice for Windows) to look within your files just to be sure if your domain appears or not.

Also, when doing a search and replace on the DB, remember to use a utility that is able to handle serialized arrays, since a simple string replacement will damage data. WP CLI's search-replace is one option. WP DB Migrate is really nice too.

Be sure to make a backup of everything before you make changes.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.