Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
858 views
in Technique[技术] by (71.8m points)

php - Where is the value for Wordpress bloginfo('stylesheet_url') saved?

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!

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...