Tag Info

Hot answers tagged

12

You are asking two questions at once: What's the difference between home_url() and site_url()? How do I get WordPress to return the URL root without the subdirectory where it's installed? Here are the answers, and I confirmed with Andrew Nacin, a core developer of WordPress, as well as ran some server tests to confirm what Andrew told me. Question # 1 ...


10

You can get the value of front in the global $wp_rewrite: global $wp_rewrite; echo $wp_rewrite->front; // or echo home_url( $wp_rewrite->front ); Though that is probably of limited use, as the front base isn't necessarily an existing page, and may 404 in many cases. If you're using that value to prepend to other URLs, you're likely doing it wrong. ...


8

get_bloginfo('url') calls home_url() calls get_home_url() reads option home get_bloginfo('wpurl') calls site_url() calls get_site_url() reads option siteurl get_bloginfo('siteurl') and get_bloginfo('home') are deprecated arguments and return get_bloginfo('url') (siteurl argument is documented wrong in Codex as equal to wpurl, it's not in current code) The ...


7

You could filter the option requests for the host. In your wp-config.php below the line … require_once ABSPATH . 'wp-settings.php'; … add the following lines: add_filter( 'pre_option_home', 'set_current_host' ); add_filter( 'pre_option_siteurl', 'set_current_host' ); function set_current_host() { return 'http://' . $_SERVER['HTTP_HOST']; } ...


6

There's a pretty good step by step on moving WordPress in the Codex. It is what I follow when changing domains. Moving the files is pretty straight-forward. It is the hard-coded references in the database that are tricky. However, serialized search and replace will take care of all database changes. I've used the Velvet Blues plugin in the past, but ...


5

If you want WP installed in a directory but the site home on your domain root, you need to move the main index.php file out to your domain root and edit the require statement to point within your directory. This process is outlined here: Giving WordPress Its Own Directory.


4

I utilize the awesome plugin Duplicator to complete this exact procedure on a regular basis. http://wordpress.org/extend/plugins/duplicator/ The plugin is fully supported and there are great FAQ available here: http://lifeinthegrid.com/labs/duplicator/ The plugin will create a .zip backup of both your database and files and an installer .php that you ...


4

The difference in your case is in filters being applied to output of these functions. While bloginfo applies one of these filters: if ( 'display' == $filter ) { if ( $url ) $output = apply_filters('bloginfo_url', $output, $show); else $output = apply_filters('bloginfo', $output, $show); } Function home_url ...


4

I believe there are some root-links that you haven't changed. Please follow these steps Login to admin section www.xyz.com/wp-admin Navigate to settings->general-> and change the 'Site Address (URL)' and 'WordPress Address (URL)'. Also please check the permalinks and settings->media there is an upload directory and the default wordpress location is ...


4

I was about to suggest something like the function bellow, but lets face it @Milo's answer is just a bit smarter, so just for completeness reason and because I already wrote it down. function wpse163163_site_url_with_fix_permalink_base() { return get_site_url() . '/' . preg_replace( '/\%([a-z0-9]+?)\%/i', ...


3

This question has been discussed several times on the WordPress Hackers email list, I'd recommend Googling something like wp-hackers absolute relative to get an overview of the various lively debates that have taken place over the years. Personally I use the searchreplacedb2 script whenever I migrate a database between URLs, e.g. from live to ...


3

I think your problem here is the esc_url() function which is used to sanitize a lot of the URLs used in wp-core. If you have a look at the function definition in formatting.php you'll see that the regex in line 2627 is filtering out [ and ]. But fortunately you can also see that in line 2656 there is a filter supplied which allows you to overwrite this ...


3

While www and non-www versions of site are considered kind of same thing from user perspective, technically they are two completely different domains, possibly hosting completely different sites on different servers. Since cookies are domain-specific WP treats them accordingly. It's not impossible to rework this, since cookie-related functions seem to ...


3

You need to update the new URL in the WordPress Address (URL) and Site Address (URL) in General settings. Some of your media may be pointing your old site or may not be available in that case you need to install a plugin named Search and Replace and you need to replace the every occurrence of the old URL with the new one.


3

Below is a small plugin using which you should be able to replace the domain for canonical url to another domain. <?php /* * Plugin Name: WPSE WPSEO Canonical * Plugin URI: http://wordpress.stackexchange.com * Description: Changes canonical url domain. * Author: Sisir * Version: 1.0 * Author URI: http://developerpage.net * **/ ...


3

Every thing you need is covered in the codex Moving WordPress entry.


3

You will have a few things to consider (later on the answer), I suggest the following steps: Backup your Files and Database This is pretty self-explanatory. You are going to do a lot of Data Manipulation, so be sure your original is safe. Transfer your files The fastest way to do this is to have a hoster where you can import directories from another ...


2

After changing siteurl, Go to admin panel and update permalink structure once and check.It will start working with new folder name. Hope it helps


2

From 'wp-includes/general-template.php' function get_bloginfo( $show = '', $filter = 'raw' ) { switch( $show ) { case 'home' : // DEPRECATED case 'siteurl' : // DEPRECATED _deprecated_argument([snipped]); case 'url' : $output = home_url(); break; case 'wpurl' : $output = site_url(); break; ...


2

Open your backend and go to Settings/General. You will see to input fields: WordPress Address (URL) Site Address (URL) The first one correspond to site_url() and the second one to home_url() So why is there a difference? Because WordPress is able to start from a different site then your blog posts. For example, create a page called 'homepage' and enter ...


2

Change your blog IDs in the wp-config.php file define( 'SITE_ID_CURRENT_SITE', 1 ); define( 'BLOG_ID_CURRENT_SITE', 1 ); That means Site ID 1 is the main site. IF you change that, another site will be the main site. You have to change your blog URLs around so it knows sub.mysite is now mysite. You'll probably have to do that in teh DB directly.


2

This question has been asked many many times before. Here's the Codex: http://codex.wordpress.org/Changing_The_Site_URL The easiest thing to do is add a couple of lines to your wp-config.php define('WP_HOME','http://example.com'); define('WP_SITEURL','http://example.com');


2

Be aware you'll need to update all links to media in any posts you've created (or pages etc.) you can do this manually or run a find replace on your SQL dump before putting the SQL onto your live site database.


2

The Misconception get_site_url() retrieves the site_url option from the database, as set under General Settings in the administrative backend / wp-admin. If this is indeed the exact same wordpress installation it will always return the same thing, regardless of whether the location is reachable via one, two or five hundred domains. You might want to ...


2

In a comment I pointed you to an existing answer that I figured would solve your problem. You replied thanks for answering. but it is working for bloginfo('url') & not for bloginfo('template_url'). Any ideas? The answer I pointed you to is easily adaptable for that: In your wp-config.php file, after (!) require_once ABSPATH . 'wp-settings.php'; ...


2

If this is a single WordPress install, there are a couple database entries with your old domain. Specifically, siteurl and home within wp_posts. That said, if the dev URL is temporary, you can also set the following two constants in wp-config.php: define('WP_HOME', 'http://' . $_SERVER['SERVER_NAME']); define('WP_SITEURL', WP_HOME . '/'); Provided that ...


1

I have updated the URLs stored in the database when the domain has changed. Here are the things to watch for: In the posts table, the post_content will have any embedded links. These you can change without issue. Again in the posts table, the gid would change if you do a global search and replace. This is mostly used with regard to RSS feeds. You can ...


1

That's why the last line of the get_admin_url contains the line: return apply_filters( 'admin_url', $url, $path, $blog_id ); Any valid modification of the admin URL will be via that filter, so get_admin_url is the correct function to use in all cases.


1

There's no need to do it the way you mean. There are ways to host multiple SSL websites on a single domain both with Apache and Nginx, and it's much easier to implement than your idea. Check out these tutorials: https://www.digitalocean.com/community/tutorials/how-to-set-up-multiple-ssl-certificates-on-one-ip-with-apache-on-ubuntu-12-04 ...


1

This code could help you, just change mysite.com and www.mysite.com and go to phpMyadmin run that Sql code: UPDATE wp_comments SET comment_author_url = REPLACE(comment_author_url, 'mysite.com', 'www.mysite.com'); UPDATE wp_options SET option_value = REPLACE(option_value, 'mysite.com', 'www.mysite.com'); UPDATE wp_postmeta SET meta_value = ...



Only top voted, non community-wiki answers of a minimum length are eligible