Support » How-To and Troubleshooting » Post preview not working

Post preview not working

Viewing 3 replies - 1 through 3 (of 3 total)
  • Similar problem. When trying to preview a post, I get :”404 — Fancy meeting you here!” page. Same when typing in permalink of the post.
    Using either Firefox or Safari, same thing happens.

    Any idea anyone?

    I’m having the same issue and I can’t seem to figure it out. It would send me to my homepage instead of sending me to my blog post preview. I would like to know what could fix this!

    I had a similar problem which I solved, thought I would share the solution because I had trouble finding one, and nobody discussed what ended up being my problem. I had slightly different symptoms than the 404 page and defaulting to the homepage — in my case, everything was loading but the content. I tried a lot of things, but here was what fixed it:

    In my case, I had written the theme and was doing some custom query filtering with pre_get_posts to include two post types in the main query. For the “general” query which included all post types possible, I was using:

    $query->set(‘post_type’, get_post_types(”,’names’) );

    But! When get_post_types() has a blank in that first argument, post previews don’t work, because it only queries publicly available (published) posts. So, to allow previews correctly again, I had to change it to:

    if(is_preview()) {$query->set(‘post_type’, get_post_types(‘false’,'names’) ); } else { $query->set(‘post_type’, get_post_types(”,’names’) ); }

    It was a rather confounding problem since there was no actual “error,” just a misunderstanding on my part of the need to have “false” as the value in that argument to allow all posts to be queried if preview was true.

    In the cases described here, I might suggest disabling plugins and checking to see that the WordPress URL and site URL match. In other cases, I know those things helped to solve the problem.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Post preview not working’ is closed to new replies.