Problem accesing WordPress within my PHP app
-
Hi!
I’m accessing the WordPress API from within my PHP code just including the wp-blog-header.php and using get_posts().
This is working ok when my PHP code is at the same level than the WP directory. For example:
/index.php
/blog/[..wp files..]At index.php, I have:
require(‘blog/wp-blog-header.php’);
$post = get_posts(…);and is working pretty well.
BUT, when I try to do the same with the code inside a directory, for example:
/blog/[..wp files..]
/folder/index.phpand at folder/index.php I have:
require(‘../blog/wp-blog-header.php’);
$post = get_posts(…);this always makes my app to redirect to the WP installation (wp-admin/install.php) and doesn’t work.
Any idea ? Can the API be used from within a directory ?
The blog is configured correctly and is working ok by itself.
Thanks!
- The topic ‘Problem accesing WordPress within my PHP app’ is closed to new replies.