jave.web
jave.web

Reputation: 15032

Wordpress allow previews outside wordpress folder

I have a file structure like

   example.com/mywordpress/  --contains WordPress
   example.com/custompreview.php --preview getter outside wordpress

I am using wp-load.php to load wordpres and using its contents. I am able to recive published posts with no problem, I even know how to make query for previews but when preview get parameters comes to the script outside the wordpress folder (custompreview.php) obviously the wp-load.php calls exit and shows only access error message.

Example is worth thousand words:

example.com/custompreview.php?preview=true&preview_id=64&preview_nonce=1f2477c5d2&post_format=standard

Shows only message "You do not have permission to preview drafts"

What is causing this? What is the wp-load.php checking for? How to fix this? :)

Upvotes: 0

Views: 236

Answers (1)

Pekka
Pekka

Reputation: 449485

If you are getting this while logged in -

the session cookie may be limited to the /mywordpress folder.

Unless explicitly specified, the cookie will be valid in the subdirectory it was set in (and all children).

I'm not sure whether it is possible to change WP's session cookie behaviour, but it may help to put the PHP file inside /mywordpress.

Upvotes: 1

Related Questions