I need to modify wp_options table

Issue Summary

I have installed a new wp site and I have imported on it a database of an already built site. Now I need to change the wp_option table to change the url because it keeps taking me to the old url. My problem is that I don’t understand the way the wp_option table is displayed in the database, it is not the same way it is displayed in phpmyadmin of a normal commercial server, where I can modify option_name and siteurl (which is not displayed in this database) . What do I need to change to be able to modify the url and redirect the path to localwp? Maybe it’s very simple, but I’m confused. Thank you very much.

Troubleshooting Questions

  • Does this happen for all sites in Local, or just one in particular? Only one.

  • Are you able to create a new, plain WordPress site in Local and access it in a Browser?
    I can install a new site in localwp bit is my first time to import a pre-build- site.

Replication

Describe the steps that others can take to replicate this issue. If you have screenshots that can help clarify what is happening, please include them!

System Details

  • Which version of Local is being used?
    5.6.3+4270

  • What Operating System (OS) and OS version is being used?

    • macOS Catalina
  • Attach the Local Log. See this Help Doc for instructions on how to do so:

@Gabriela, it looks like you’ve clicked on the link that takes you to the structure of the table, and that you’re trying to modify that. I think what you want is to click on the link to the left of the table name (in your case, “registros”). That will show you the data in the table, and allow you to edit it. Clicking on the name of the table in Adminer allows you to view the table’s structure.

That said, you may also find a plugin like WP Migrate (or Better Search and Replace) to be a better tool to search and replace the hostname/URL throughout the database, as opposed to manually working through the database tables (wp_options is only one place where the URL ends up in the data). I only mention WP Migrate as the first suggestion as it is incredibly useful for this purpose, but offers so much more in the migration of WP sites.

Hope this helps.

1 Like

Thanks, my problem is that the site always redirects me to the original url, so I can’t access the local site’s wordpress admin, such as to install Better Search Replace which is a plugin. With your instructions (look in “registros”, thanks!) now I tried to change the url in wp_option, but the system won’t let me, so I’m really lost and I don’t know what I’m doing wrong.

Good point on the inability to use a plugin here.

I’m not sure why the system won’t let you update the value via Adminer. There are a number of other options that you could try – of course, replace the URL with that of your site, and make sure that URL matches the one set in Local for the site.

  1. If you’re having issues editing the value directly within Adminer, you could try running SQL to perform the update – something like:

update wp_options set option_value = 'https://example.com' where option_name = 'siteurl';
update wp_options set option_value = 'https://example.com' where option_name = 'home';

  1. Modify the SQL file before re-importing it via Adminer.
  2. Add something like this to your theme’s functions.php file and try loading the site:

update_option( 'siteurl', 'https://example.com' );
update_option( 'home', 'https://example.com' );

  1. Alternatively, you could override the database entries by placing entries in the wp-config.php file along the lines of:

define( 'WP_HOME' , 'https://example.com' );
define( 'WP_SITEURL' , 'https://example.com' );

It’s going to be better to get those database entries correct. The last one won’t touch the database, but uses a little brute force to override the database entries.

2 Likes

Hi @Gabriela :wave:

@burt has provided a ton of good suggestions in the post above, do let us know if you give those a go and if you need more support!

Sam

Thank you! I still need time for to do some tests, I think I will reinstall. Thank you very much. Has been an invaluable help

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.