How to update get_stylesheet_directory_uri in wordpresss - wordpress

How do I update get_stylesheet_directory_uri? Transferring a website and I have already updated the url for the site inside wp-config using:
define('WP_HOME','https://somewebsite.com');
define('WP_SITEURL','https://somewebsite.com');
Still when get_stylesheet_directory_uri is called it is using a previous url, any idea on how to force this to update?
Thanks!

Once you change the site URL using those DEFINE statements, you also need to flush the permalink settings. Just go to wp-admin -> Settings -> Permalinks, and save without making any changes. That should force it to use your new values.

If you have access to the site via FTP, then this method will help you quickly get a site back up and running, if you changed those values incorrectly.
FTP to the site, and get a copy of the active theme's functions.php file. You're going to edit it in a simple text editor and upload it back to the site.
Add these two lines to the file.
update_option( 'siteurl', 'http://example.com' );
update_option( 'home', 'http://example.com' );
Use your own URL instead of example.com, obviously.
Upload the file back to your site, in the same location. FileZilla offers a handy "edit file" function to do all of the above rapidly; if you can use that, do so.
Load the login or admin page a couple of times. The site should come back up.

Another thing that can happen if your site is multilingual is that get_stylesheet_directory_uri is used in a registered string whose translation is still using the previous domain. In that case, search and replace your translations with the new domain.

Related

Wordpress redirecting to a non existing domain

I was editing my WordPress dashboard and I made a type in the site url.
This typo is now causing me to be redirected to a nonexistent domain whenever I try to login through the dashboard.
how can I fix this? I currently have FTP access.
I think the issue is you have entered the wrong domain name in the site URL and home URL.
that's why you are not able to access the website.
For this issue, there are two ways.
1) the First Method
Edit wp-config.php
It is possible to set the site URL manually in the wp-config.php file.
Add these two lines to your wp-config.php, where “example.com” is the correct location of your site.
define( 'WP_HOME', 'http://example.com' );
define( 'WP_SITEURL', 'http://example.com' );
This is not necessarily the best fix, it’s just hard-coding the values into the site itself. You won’t be able to edit them on the General settings page anymore when using this method.
2) Second Method
Edit functions.php
If you have access to the site via FTP, then this method will help you quickly get a site back up and running, if you changed those values incorrectly.
FTP to the site, and get a copy of the active theme’s functions.php file. You’re going to edit it in a simple text editor and upload it back to the site.
Add these two lines to the file, immediately after the initial “<?php” line:
update_option( 'siteurl', 'http://example.com' );
update_option( 'home', 'http://example.com' );
Use your own URL instead of example.com, obviously.
Upload the file back to your site, in the same location. FileZilla offers a handy “edit file” function to do all of the above rapidly; if you can use that, do so.
Load the login or admin page a couple of times. The site should come back up.
Important! Do not leave this code in the functions.php file. Remove them after the site is up and running again.
Note: If your theme doesn’t have a functions.php file create a new one with a text editor. Add the <?php tag and the two lines using your own URL instead of example.com:
<?php
update_option( 'siteurl', 'http://example.com' );
update_option( 'home', 'http://example.com' );
Upload this file to your theme directory. Remove the lines or the remove the file after the site is up and running again.
For more details Here I have shared the WordPress org Support Link
If you have access to the database, you can go into PHPMyAdmin, click on wp_options, then search for both home and site_url (or possibly siteurl) and you can change your values there as well. The previous commenter's methods will also work but using functions.php is unnecessary and using wp-config is a temporary fix, in my opinion.

Wordpress - Changing Wordpress in Place to a New Domain

I have Wordpress install at
scottmollon.com/williammessner-loebs
The files are in public_html/williammessnerloebs
But we wanted to get him his own domain.
So I got bloebs.com, and set it up as an Add-On Domain with my host provider (A2 Hosting).
I configured bloebs.com to point to /public_html/williammessnerloebs
So if you go bloebs.com you correctly see the wordpress site.
But if you click on a post it takes you to scottmollon.com/williammessnerloebs/2019/10/10/appearances/
for example.
I'd like to have all the urls be bloebs.com urls.
I tried changing the site url and home url in my Wordpress general settings, but that just breaks everything. Pages load with no formatted or styled content or images. I've fixed it by editing those urls back to scottmollon.com urls in my database.
Is there anyway I can accomplish what I hope to do?
The first step you took was the right. But there is some more to do:
Change your site url and home url. You can do this in the backend in general settings, or you can edit your wp-config.php file and add (maybe you have https):
define( 'WP_HOME', 'https://bloebs.com' );
define( 'WP_SITEURL', 'http://bloebs.com' );
Log into your backend (you will be logged out at first) and go to your general settings to check if the new url is set. Also go to "permalinks", make your choice and hit save.
Install a Plugin to overwrite the urls in your database, like https://wordpress.org/plugins/go-live-update-urls/ In this plugin you just need to enter your old wordpress url and then your new url. You do not need to overwrite plugin files, so keep that unchecked.
After that, everything sould be working fine. You can delete the plugin again, because you don't need it anymore.
If you have any urls in your theme files, that you are not getting dynamically but have inserted them by hand, you have to edit this by hand. The Plugin "Go live..." will only overwrite the urls in your database.
Hope this helps you out.

I just get html with no css as my wordpress page, I can't get to the admin panel, or the wp-login.php page

I changed the address (I think site location) of my wordpress url to a different url. When I did that, I could no longer access the admin page or the wp-login page but I got to the website.
I'm really confused on whats going on, I also tried setting up phpmyadmin (after the fact) and it redirects me to the page I already made.
So basically, how can I get the visual admin page back so I can continue making pages, and how can I get it to where its not showing raw html.
I would take a look here and follow one of the steps. I had the same issue with my site and editing the fuctions.php file resolved this.
The two main fixes usually are:
Edit WP-Config.php
define('WP_HOME','http://example.com');
define('WP_HOME','http://example.com');
Add these two lines to your wp-config.php, where "example.com" is the correct location of your site
Edit Functions.php
update_option( 'siteurl', 'http://example.com' );
update_option( 'home', 'http://example.com' );
Add these two lines to the file, immediately after the initial <?php line.

Migrating wordpress

I am trying to migrate a Wordpress website from one hosting to another one. In the new hosting I can see it correctly if I access it from localhost, but if I try to render the web from an exteral pc, the .css and the images are not loaded (you can see it here 91.121.122.50/wp
Note that the link to the images points correctly (if you copy-paste the url of any image and open in a new window, it will load)
The new host has been configurated for a user, so I think it is a etc/hosts, apache2 or php configuration issue.
You can either update the database
//FIXME: do comment/remove these hack lines. (once the database is updated)
update_option('siteurl', 'http://your.domain.name/the/path' );
update_option('home', 'http://your.domain.name/the/path' );
http://codex.wordpress.org/Moving_WordPress
or place the folowing in you wp-config
define('WP_HOME','http://example.com');
define('WP_SITEURL','http://example.com');
http://codex.wordpress.org/Changing_The_Site_URL
In order to make all links working you've to update your htaccess in your admin area under settings -> permalinks.
There is a WordPress plugin called duplicator. Using this plugin we can transfer WordPress website from one host to another. I think this is the simple and easy way to transfer WordPress sit. Here is the link.

Wordpress wp-login undefined redirect

After moving a wordpress installation from a remote server back to my localhost I ran into a problem I cannot seem to fix.
downloaded all files and the database
changed url's in the options db table
changed the .htaccess to run in the right directory
For some reason, when I now go to the WP admin directory and I try to login, after I press the login button it redirects to /wp-login.phpundefined/. Note the undefined behind the wp-login.php. It, of course gives a 404 page. I'm also not logged in, when I go to the WP admin again I still need to login. The code of the login has the right form action, so it happens somewhere in the process of the login script.
Anybody any idea what might cause this? Cheers!
Edit your wp-config.php to force the domain your WP installation is on.
define('WP_HOME','http://example.com');
define('WP_SITEURL','http://example.com');
If that doesn't work, use the Fine and Replace tool that will replace all instances of your site's URL from your old database to your new site URL.
i.e. Find and replace.
http://localhost/
to
http://example.com/
wp-login.php can be used to (re-)set the URIs.
Find this line:
require( dirname(__FILE__) . '/wp-load.php' );
and insert the following lines below:
// FIXME: do comment/remove these hack lines (once the database is updated).
update_option('siteurl', 'http://your.domain.name/the/path' );
update_option('home', 'http://your.domain.name/the/path' );

Resources