Skip to main content

Command Palette

Search for a command to run...

How to Update Logo Path After WordPress Migration

Updated
5 min read
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:

  1. Navigate to WordPress Admin Dashboard

  2. Go to Appearance > Customize

  3. Click on Site Identity

  4. Click "Change Logo" or "Select Logo"

  5. Upload the logo again or select from media library

  6. Save and publish the changes

Using Better Search Replace Plugin

  1. Install and activate the Better Search Replace plugin

  2. Go to Tools > Better Search Replace

  3. In "Search for" field, enter the old site URL

  4. In "Replace with" field, enter the new site URL

  5. Select all relevant database tables

  6. 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

  1. Install and activate Better Search Replace from WordPress plugins

  2. Go to Tools > Better Search Replace in your WordPress dashboard

Fix Logo Path

  1. In "Search for" field, enter your old site URL (e.g., http://oldsite.com)

  2. In "Replace with" field, enter your new site URL (e.g., http://newsite.com)

  3. Select all database tables using Ctrl+A (Windows) or Cmd+A (Mac)

  4. First run a test by keeping "Run as dry run" checked

  5. Click "Run Search/Replace" to see affected rows

  6. If results look correct, uncheck "Run as dry run"

  7. 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:

  1. Decrease the "Max Page Size" in plugin settings

  2. Create a complete backup before making changes

  3. Always run a dry run test first to see affected rows

  4. 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:

  1. Access phpMyAdmin through your hosting control panel (cPanel).

  2. Select your WordPress database from the left sidebar.

  3. 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:

  1. Access phpMyAdmin through your hosting control panel

  2. Select your WordPress database from the left panel

  3. Navigate to the wp_options table (note: your prefix might be different)

  4. 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

More from this blog

T

Tenten - AI / ML Development

225 posts

🚀 Revolutionize your business with AI! 🤖 Trusted by tech giants since 2013, we're your go-to LLM experts. From startups to corporations, we bring ideas to life with custom AI solutions