在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

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(); ?>

This might help if I am understanding your question:

  1. Login to WordPress admin dashboard
  2. Click on Settings >> General
  3. Fill in your WordPress Address and Site Address and click Save.

You can use home_url PHP function:

<a href="<?php echo home_url(); ?>">Home</a>

You may need to install a widget/plugin to support PHP in WordPress pages. Check out this answer.

use the broken link checker plugin. which will scan all your links and return to you all the links that are not part of your site()_url then you can just edit the urls, find plugin here or you may go to you php myAdmin and run the following query

UPDATE wp_posts SET post_content = REPLACE(post_content, 'localhost/silverspring/', 'www.yourlivesite.com/');

wp_ will depend of what you have given your tables prefix.