I’m trying to have sort of a functionality that will let me find all internal links on my site that are pointing to a page. i.e – I want to know all pages on my site that are linking to (any) page in my site.
I tried to find sort of a ready made plugin for that, but didn’t seem to find.
I can develop one by myself, but I wonder what will be the best way to have such functionality.
Any ideas will be very welcomed .
Thanks
Leave a Reply
You must be logged in to post a comment.
Post Search Approach
substr_count( 'http://www.yourdomain.com', $page->content );
This will of course miss allot of links made by plugins, navigation etc – hence “half-ass”.
Site Scraping Approach
file_get_contents( $the_url )
to get the page / post as a stringThis approach will double count the links persistent through many pages (navigation and sidebars).
There is, I’m sure a much better way to do this – but that’s all I could come up with off the top of my head. I’m sure you could tweak either approach to suit the degree of coverage you want.