• Resolved iTerentius

    (@iterentius)


    Hi Bill,

    I love your stuff and reference you all of the time as well.

    I seem to be having an issue I’ve narrowed down to the Display Posts plugin. I’ve been seeing mix ups with other post types getting confused and duplicating regular posts. Removing Display Posts fixes the problem. This is especially an issue with Pop Up Maker. When editing one of their themes (custom post type) it gets conflated with a blog post and gets lost between worlds when saving.

    I’ve removed every other plugin, function code and even switched to TwentyNinteen theme and still get the problem. Any ideas?

    I really want to keep using this if possible…

    Thanks,
    Isaac

Viewing 1 replies (of 1 total)
  • Plugin Author Bill Erickson

    (@billerickson)

    Thanks for the message.

    That’s a really strange issue. What version of WordPress are you using, and are you using Classic Editor or Gutenberg?

    Do you have any plugins that are rendering the shortcodes in the backend? What you’re describing sounds like a known bug in WordPress core (see here).

    (here’s the technical summary if you’re interested) When you do a custom query in WordPress, you should run wp_reset_postdata() to reset everything back to the original post data. BUT this function doesn’t work in the WordPress admin. You need to manually back up the global $post variable and restore it after your custom query.

    My guess is a plugin (it sounds like Pop Up Maker) is rendering the shortcode in the backend to give you a live preview and that’s breaking everything due to the WP core issue.

    Can you try adding this code snippet to your theme’s functions.php file or the code snippets plugin? Let me know if it fixes the issue for you: https://gist.github.com/billerickson/08ab6c2024683470128a5e25ec51bf65

    If you can narrow it down to the Pop Up Maker plugin doing the backend rendering, you might reach out to them about the WP core issue.
    Thanks

Viewing 1 replies (of 1 total)
  • The topic ‘Post type confusion’ is closed to new replies.