Display wordpress posts on non wordpress page

Many times we need all wordpress functions outside the wordpress. For example if we need to create API for send the data to users in json format or XML. Then we need to create sample.php file on root. I share two useful examples for get the wordpress functions outside the wordpress. With follow these examples you can do any type of work of wordpress in outside file.

Method 1:

wp-load.php is the wordpress core file which included all the functions of wordpress. This is light weight method. but it doesn’t call wp() or invoke the template loaders used by themes.

Method 2:

if you need all the WordPress the default functions, hooks/actions and theme functions. You can use wp-blog-header.php file in simple php file.

If you are facing any problem in WordPress functionality or customisation contact me feel free or comment below this is my pleasure if I can help you. Thanks for reading.

Add a Comment

Your email address will not be published. Required fields are marked *