duanchuang3182 2016-10-17 05:43
浏览 105

在wordpress编辑器中替换localhost url

I am new to Wordpress. I am converting html site to wordpress site and have added webpage content in the wordpress text editor. Everything is fine, but i have a link in that webpage which redirects to home page, i.e anchor tag with reference to index.html. So after adding that page to wordpress in text editor, i have changed it to "http://localhost/sitename/" which links to home page.

My question is, how to remove localhost and yet link it to homepage. I tried php home_url(); inside anchor tag but didn't work.

I am attaching screenshot enter image description here

  • 写回答

4条回答 默认 最新

  • drctyr2869 2016-10-17 05:59
    关注
    get_site_url( int $blog_id = null, string $path = '', string $scheme = null )
    

    Retrieves the URL for a given site where WordPress application files (e.g. wp-blog-header.php or the wp-admin/ folder) are accessible.

    get_home_url( int $blog_id = null, string $path = '', string|null $scheme = null )
    

    Retrieves the URL for a given site where the front end is accessible.

    In your case you can use

    <?php echo get_home_url(); ?>
    
    评论

报告相同问题?