Thread tagged as: Problem, Configuration, Blog

Blog Draft not working correctly - Cannot preview drafts


I have an issue - when setting the status of a blog post to "draft" the preview button takes to the correct page, but the page does not show the blog.

The following is my code for displaying the specific blog

$blogPost = perch_blog_custom(array(
   'filter' => 'postSlug',
   'match' => 'eq',
   'value' => perch_get('s'),
   'section' => 'posts',
   'template' => 'post.html'
), true);

echo $blogPost;

This displays blogs correctly, but does not show drafts (I am correctly logged into perch).

Any ideas?

Matthew Lymer

Matthew Lymer 1 points

  • 5 years ago

I have also attempted to use perch_blog_check_preview, but no luck.

Drew McLellan

Drew McLellan 2638 points
Perch Support

perch_blog_check_preview() is called internally, you don't need to call it yourself.

If you turn debug on, what does it output on the preview page?


I'm not sure if there is an issue with perch_blog_check_preview();

If I call it, nothing works, however I can get it to work by calling part of the perch_blog_check_preview() function manually:

            $Users          = new PerchUsers;
            $CurrentUser    = $Users->get_current_user();

            if (is_object($CurrentUser) && $CurrentUser->logged_in()) {

                PerchUtil::debug('Entering preview mode');
                PerchBlog_Posts::$preview_mode = true;


So possibly an issue surrounding the PERCH_PREVIEW_ARG variable, I'll have a look at the debug and see if I can troubleshoot the preview_arg once I get on my own machine.

Drew McLellan

Drew McLellan 2638 points
Perch Support

Can you post your diagnostics report?