Custom Post Type Draft Preview Goes to 404

I had a colleague take a look at the entire plugin code and he found a function I had written which was forcing the query to only show ‘Published’ posts. This was interfering with the preview as it was being treated as a front-end query. I was able to bypass it by adding the parameter !$query->is_preview() to my conditions and it is now sorted.

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)