Where is the value for Wordpress bloginfo('sty

2019-01-26 21:20发布

问题:

I'm setting up a Wordpress site (as a newbie). The way it works is that I have an installation on a development server where I change stuff and then someone else moves my changes to the live server.

Now I've come across the problem that while everything works fine on the dev server, the live server doesn't pull the correct CSS stylesheets. In the <head> of the HTML file I can see two links to the stylesheet, and both point to the development server URL rather than the live server URL.

If I'm not mistaken, this info is pulled from bloginfo('stylesheet_url').

Now I have no clue where the value for this comes from. I've searched every single file in the live installation and could not find any hardcoded links (apart from that I'd have remembered to have set up hardcoded links).

Where then is this value saved?

Many thanks in advance!

回答1:

If you're going to move databases from local to live - or from any domain to another - you need to change URLs in the database. Also see Moving WordPress « WordPress Codex

You can use these queries in phpmyadmin to change URLs:

UPDATE wp_options SET option_value = replace(option_value, 'http://olddomain.com', 'http://newdomain.com') WHERE option_name = 'home' OR option_name = 'siteurl';

UPDATE wp_posts SET guid = replace(guid, 'http://olddomain.com','http://newdomain.com');

UPDATE wp_posts SET post_content = replace(post_content, 'http://olddomain.com', 'http://newdomain.com');

UPDATE wp_postmeta SET meta_value = replace(meta_value, 'http://olddomain.com', 'http://newdomain.com');

A better method (answer updated 8/01/2014) is to use https://interconnectit.com/products/search-and-replace-for-wordpress-databases/ , which correctly deals with serialized data in the database; the SQL queries abov will break serialied data, and you may lose some theme and ohter options as a result. That script is recommened on the http://codex.wordpress.org/Moving_WordPress Codex page.



回答2:

Well its not saved, the stylesheet_url is you current themes url. wp-content/themes/your-theme/ . You current theme's folder name is stored in the database's options table usually wp_options. Where template='your-theme-name'. If you want to change the site url change siteurl row's value in the same table



回答3:

The problem is probably with the base URL, and not specific to the CSS. Look under the admin panel, Settings -> General -> "WordPress address (URL)" and "Site address (URL)"