How to Update Logo Path After WordPress Migration

There are several effective methods to fix the WordPress logo URL after migration:
Using Theme Customizer
The simplest method is to update the logo through WordPress's built-in customizer:
Navigate to WordPress Admin Dashboard
Go to Appearance > Customize
Click on Site Identity
Click "Change Logo" or "Select Logo"
Upload the logo again or select from media library
Save and publish the changes
Using Better Search Replace Plugin
Install and activate the Better Search Replace plugin
Go to Tools > Better Search Replace
In "Search for" field, enter the old site URL
In "Replace with" field, enter the new site URL
Select all relevant database tables
Run the search/replace operation
Using Custom Code
If the above methods don't work, you can add this code to your theme's functions.php file:
function custom_logo_url($logo_html) {
$custom_logo_id = get_theme_mod('custom_logo');
$new_url = 'https://your-new-site.com';
$logo_html = sprintf(
'<a href="%1$s" class="custom-logo-link" rel="home" itemprop="url">%2$s</a>',
esc_url($new_url),
wp_get_attachment_image($custom_logo_id, 'full', false, array('class' => 'custom-logo'))
);
return $logo_html;
}
add_filter('get_custom_logo', 'custom_logo_url');
Remember to replace 'https://your-new-site.com' with your actual new site URL.
Important Tips
Always create a backup of your website before making any changes
Clear your WordPress cache and browser cache after making changes
If using hardcoded URLs, check and update them in header.php and other theme files
Verify the changes by checking your website's header across different pages
How can I use the Better Search Replace plugin to fix the logo path issue
Here's how to fix the logo path using Better Search Replace plugin:
Installation and Setup
Install and activate Better Search Replace from WordPress plugins
Go to Tools > Better Search Replace in your WordPress dashboard
Fix Logo Path
In "Search for" field, enter your old site URL (e.g., http://oldsite.com)
In "Replace with" field, enter your new site URL (e.g., http://newsite.com)
Select all database tables using Ctrl+A (Windows) or Cmd+A (Mac)
First run a test by keeping "Run as dry run" checked
Click "Run Search/Replace" to see affected rows
If results look correct, uncheck "Run as dry run"
Click "Run Search/Replace" again to make the actual changes
Verification
After completing the replacement:
Check your logo appears correctly
Clear your website cache
Verify the logo displays properly across all pages
Once finished, you can safely deactivate and delete the plugin as it's only needed for occasional use.
What steps should I take if the Better Search Replace plugin doesn't work
If Better Search Replace plugin isn't working, here are alternative solutions:
Add RELOCATE to wp-config.php
Add this line to your wp-config.php file:
define('RELOCATE', true);
This allows you to login and replace URLs with the correct address. Remove the line after fixing the issue.
Alternative Methods
Use Advanced Search Replace This paid alternative is more reliable and has fewer issues than the free Better Search Replace plugin.
Use WP-CLI If you have SSH access, WP-CLI is the most reliable method for search and replace operations.
Troubleshooting Tips
If experiencing timeouts or white screens:
Decrease the "Max Page Size" in plugin settings
Create a complete backup before making changes
Always run a dry run test first to see affected rows
Use specific search strings to minimize unintended replacements
For Elementor sites specifically, you must regenerate CSS & Data after replacing strings.
How do I manually update the logo path in the WordPress database
To manually update the logo path in the WordPress database, you'll need to use phpMyAdmin and follow these steps:
Access phpMyAdmin through your hosting control panel (cPanel).
Select your WordPress database from the left sidebar.
Navigate to the wp_options table and execute this SQL query to update the logo path:
UPDATE wp_posts SET post_content=(REPLACE (post_content, 'old-logo-path', 'new-logo-path'));
For a more comprehensive solution, you can also:
Alternative Methods
Using Search and Replace Plugin
Install a search and replace plugin
Navigate to Tools > Better Search Replace
Enter the old URL in "Search for"
Enter the new URL in "Replace with"
Select the relevant database tables
Update WordPress Settings After updating the database, you should also update your site URLs in:
Dashboard > Settings > General
wp-config.php file using WP_SITEURL and WP_HOME constants
Note that if your data is serialized, you'll need to use specialized tools to handle the replacement properly, as direct SQL replacement could break the serialization.
How do I update the logo path in the database using phpMyAdmin
To update a logo path in the database using phpMyAdmin, follow these steps:
Access phpMyAdmin through your hosting control panel
Select your WordPress database from the left panel
Navigate to the wp_options table (note: your prefix might be different)
You can update the path using one of two methods:
Direct Table Edit
Locate the option that stores your logo path
Double-click the option_value field containing the path
Enter the new path
Press enter to save the changes
Using SQL Query
UPDATE wp_options
SET option_value = 'new/path/to/logo.png'
WHERE option_name = 'your_logo_option_name';
Important Notes:
Replace 'wp_' with your actual table prefix
Make sure the new path is relative to your WordPress installation or uses a full URL
Always backup your database before making changes
Verify the changes by checking your website after the update






