I have an issue that is occurring with a custom post type, the fields are created with ACF.
I created plugin , that has a function that uses WP_query to pull 1 post and display it in a Divi Module using a shortcode.
It works fine, displays everything correctly. However if you delete the post its displaying , then reload the page, the site layout breaks in that section.
I initally thought it may have something to do with resetting the query, and tried wp_post_reset , but nothing seems to work
Note, that if the post that was deleted is restored from the trash, then all is well again .
Here is a link to the code: https://gist.github.com/colbyalbo/8fb906f7c20a7bc2b035b2d7bcc36912