I’m migrating an existing WordPress site (a custom theme that I developed) to Bedrock. I manually migrated over the theme files, put the plugins in composer.json, put the media files in the right place, did a wp search-replace for the old and new url, and then did a search-replace for /wp-content to /app.
However, I’m having an unexpected result. get_the_post_thumbnail() and wp_get_attachment_image_src() are both returning the image urls in the following format:
/wp/app/uploads/09/12/filename.jpg
Have I done something wrong in the migration? Any suggestions?
I’ve ran into this a few times but I forget exactly what it is. I believe it was a setting in the database that was causing these problems for me, possibly related to media folder location.
Do you happen to be using an older Roots theme as well?
Thank you, that was just enough to figure it out. Using Phpstorm and Xdebug, I traced wp_get_attachment_image_src() all the way back until _wp_upload_dir() and found the problem. It would appear that if a value for upload_path is set in the database, it joins that upload path with ABSPATH to make the upload_dir_path. However, if it’s empty, it simply joins the WP_CONTENT_DIR constant with ‘/uploads’ which is obviously what we wanted.
Short story, I deleted the upload_path from wp_options table and now everything works as expected.
Really appreciate the help in pointing me the right direction.