Can you change the value of the Bloginfo in the ge

2019-09-13 01:00发布

I am facing a great challenge, I am working on a site that has been converted from HTML into WordPress and I have the front-page displaying all the content right but not the other pages as the urls are not pointing correctly. I wonder if instead of changing manually all the URL from 150 pages there is a way that I change the main url path values in wp-includes/general-template.php from this:

    <?php  bloginfo('template_url');  ?>

into something like the real URL: http://example.com/

In other word by doing so, if successful, I will make only one change on the wp-includes/general-template.php and have all the broken links fixed...?

Anyone has a clue?

Many thanks all....(I am running out of time and options....help is greatly appreciated..:)

Daniele

2条回答
闹够了就滚
2楼-- · 2019-09-13 01:41

If I understand your question right, wordpress does not work like that, if you have broken links that point to incorrect domain you need to make the change from phpMyAdmin using this query to replace URLs:

UPDATE wp_options SET option_value = replace(option_value, 'http://www.oldurl', 'http://www.newurl'); 

but make sure to change the table prefix, and do a search on the incorrect url in your database to know what tables have that url, then change table name and column in the query above based on your search.

查看更多
Evening l夕情丶
3楼-- · 2019-09-13 01:49

Found a way around by changing the wp-includes/general-template.php on line 693 from the following:

    case 'template_directory':
    case 'template_url':
        $output = get_template_directory_uri();

to the following:

    case 'template_directory':
    case 'template_url':
        $output = site_url( 'mising_url_path_here' );

now I have fixed all the broken link for js/images/other files and can be viewed.

查看更多
登录 后发表回答