trying to change the world, on a budget

How to Query WordPress Posts from Outside of WordPress

It’s surprisingly easy, just 2 lines lets us put on a disguise and start digging into WordPress:

define(‘WP_USE_THEMES’, false);

require(‘../wp-load.php’);

That’s it!  (Replace the path to wp-load with the path to your WordPress root.) After loading these files, you can query WordPress as normal and do whatever you want with all the juicy post data. In fact, you might even be able to include files from your WP theme – for my needs, I ended up just including my normal WordPress loop file. Viva la code reuse!

This is really useful for large websites where you’ve got components that are not WP side-by-side with a WP site, now they can talk to each other.

I thought this was going to be a lot harder then it was, answer found courtesy Kenn Wilson.