WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is there someway to get a list of all links on a page, including links in theme files, header, footer, sidebar, posts, etc?

It is possible to do this in JavaScript, but I'm hoping for a server-side solution.

share|improve this question

it is possible to do on server side but you would have to create an output buffer and the either use Regex or Dom phrase to get all of the links. a much easier solution would be to use JavaScript or even better jQuery.

share|improve this answer
Agreed, JS/jQuery is definately the favorable approach here. – t31os Aug 6 '11 at 11:00
I have a jQuery solution working at the moment, where I pass some links to the server with jquery.post(), get a new list of links as a response, and then modify the page. The major downside is there is no caching of these ajax requests. Is it possible to get this working to cache these requests with WP super cache? – jess Aug 10 '11 at 15:37
Not really caching but you can save the links in the database before you return your respond, and next time just call that saved data. – Bainternet Aug 10 '11 at 18:31

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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