0

I will change the url of an existing post. And I need to change my internal links from other post to this post, to the new url.

The problem is I don't know which are the posts that link to this post. How can I find them?

3
  • 1
    Links are just part of the content, so searching for the link should reveal them. What people normally thing to do in cases like this though is to just create a redirect from the old url to the new once. Oct 25, 2017 at 4:52
  • You can write redirect script in your .htaccess file for the same Oct 25, 2017 at 5:25
  • Slim SEO Link Manager plugin might help. It auto updates all links to posts when their URLs change.
    – Anh Tran
    Jan 12, 2023 at 1:50

1 Answer 1

0

It seems that finding your internal links is as simple as searching your site using the build in WP search widget! You just paste the link you are searching for and WP will show you all post or pages containing the link (no matter what anchor you used).

I didn't know the default search function was that powerful. Jacob Peattie already commented on my question about searching, but it was not obvious he was referring to the build-in search widget.

If you don't have the search widget installed you can do the search directly on the url address bar by pasting:

domaintosearch.com/?s=yoursearchterms

If you search for links be sure to paste them in the correct format, for example if you search for http://example.com you should paste:

domaintosearch.com/?s=http%3A%2F%2Fwww.example.com

There is also a code you can use to perform the search:

<?php
$query = new WP_Query( 's=keyword' );
if ($query->have_posts()){
  while ( $query->have_posts() ) { $query->the_post();
      the_title();
  } //end while
}
1
  • this is actually not searching for a link but for a url. in addition links might be in other places than post content. Depending on what the link is and at what point the site development is, you might need a redirect of some kind in any case. Oct 25, 2017 at 12:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.