Tag Info

Hot answers tagged

10

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


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


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


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


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

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

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

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'; ...


1

There is no need to use any plugins, scripts or even knwledge of sql. Simple notepad is enough to migration. You have to upload your all wordpress files to your new server and just change in your wp-config.php (in your main wordpress folder) 3 values: define('DB_NAME', 'your_new_db_name'); define('DB_USER', 'your_db_username'); define('DB_PASSWORD', ...


1

To create a basic plugin, add a directory in wp-content/plugin, then put a php file in it with the required header, and that's it. Now, here is how to use the action : add_action( 'wpmu_new_blog', 'user16975_customize_blog', 10, 6); function user16975_customize_blog($blog_id, $user_id, $domain, $path, $site_id, $meta ){ // do not forget to select the ...


1

I think this will do what you are looking for. add_action("template_redirect", 'template_redirect'); function template_redirect() { global $wp; if(is_user_logged_in() && !isset($_GET['user'])){ $current_user= get_userdata(get_current_user_id()); ...


1

You can filter home_url: add_filter( 'home_url', 'wpse102523_home_url' ); function wpse102523_home_url( $url ) { return $url . 'index.php/'; } Reference: Adam Brown's Filter Database


1

Easiest way is to install Quick Page/Post Redirect Plugin. Then you'll just have to create a new page with the Title (and Permalink) country when editing this page you'll then have the possibility to redirect it to the other page.


1

To avoid using deprecated call bloginfo('home') added new function to qtranslate_core.php: function qtrans_convertHomeURL($url, $what) { if($what=='/') return qtrans_convertURL($url); return $url; } and new filter to qtranslate_hooks.php: add_filter('home_url', 'qtrans_convertHomeURL', 10, 2); This way no other changes were needed. Not the best ...


1

Caching is not your problem here. The home URL and site URL are stored in the wp_options table in your database. You can update them either by visiting the Settings > General page in your WordPress dashboard, or you can edit the siteurl and home option values directly in the database through an SQL query or a client such as phpMyAdmin. You can also override ...


1

See the Moving WordPress page in the Codex. When your domain name or URLs change - i.e. from http://example.com/blog to http://example.com, or http://example.com to http://newexample.com - there are additional concerns. The files and database can be moved, however references to the old domain name or location will remain in the database, and that can ...


1

Add the following custom function in functions.php file of your theme to get the page url without the clean urls function get_page_custom_link() { global $post; $link = ''; if ( 'page' == get_option( 'show_on_front' ) && $post->ID == get_option( 'page_on_front' ) ) $link = home_url('/'); else $link = ...


1

Copy the index.php and .htaccess file(Just copy it , do not move it ) from myblog directory to root directory. Open index.php file in any text editor and find the following code in the file. /** Loads the WordPress Environment and Template */ require('./wp-blog-header.php'); Replace it with the following code and save the file. /** Loads the WordPress ...


1

I would be very hesitant in having the same database for staging and live as any changes to the database would affect both sites (especially when using software like Wordpress where there is configuration in the database). The only time that I would think of pointing to the live database would be if I was doing theme development and was not going to change ...


1

To answer you second question: Q: If that's correct, then can I get wordpress to return http://example.com/ ? Not unless you use the giving WordPress it own directory. Using this means you put WordPress core files into /blog or /WordPress and then the index.php into your root If you decide to put WordPress inside its own directory then you would use ...



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