Support » Plugin: Post Type Switcher » Strange behaviour with comments: visible on back end but not on front end

  • Resolved ypeynaud

    (@ypeynaud)


    Hi there,

    Thanks for this plugin which should save my life: I need to migrate a hundred of custom post types to regular posts.

    The CPT are nicely migrated but attached comments don’t show with the posts on the front end. Oddly, when editing such a post, comments regularly appear on the back end, seemingly attached to the post. When clicking “view post” again, they don’t show.

    I have tried to manually update such comments but no change. I also tried to switch back the posts to their original CPT and they regularly show up again on the front end with their comments regularly attached.

    [Addition] It seems to be related to “comment types”: when looking all comments on the back end in the main “Comments” page, there is a way to filter comments per “comment types”. Comments attached to posts coming from CPT show when “All comment types” are shown. But when selecting the (only) option “Comments” in the filter drop-down, the comments attached to posts coming from CPT don’t show.

    Any idea how to change the comment type? can we do that with PST with a filter or any other way?

    Thx!

    • This topic was modified 9 months ago by ypeynaud.
Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter ypeynaud

    (@ypeynaud)

    OK, I have had a look at the WP database and it turns out that the wp_comments database do have a “comment_type” field storing the comment type.

    In my case, the custom post type I switched has its own comment type. But when using PST to switch from CPT to regular post type, this field is not updated, intentionally or not.

    As a result, it depends how the theme chooses to display comments. On the back end, probably all comment types are fetched when displaying regular posts, so the comments appear. But on the front end, probably only the “comment” comment type is fetched, so the comments coming from the CPT do not show since they do not have this “comment” type.

    So it comes back to the question in my first post: could/would/should PST switch the comment type as well when switching post type? A filter would be convenient.

    Thanks in advance for your answer or any tip.

    Thread Starter ypeynaud

    (@ypeynaud)

    I have investigated further this “comment_type” field in the wp_comments database and as far as I understand, the types expected for this field in WordPress are: ‘comment’, ‘trackback’, ‘pingback’ or ‘pings’.

    For some reason, the plugin generating the custom post types I want to switch from (namely DWQA Questions & Answers) uses a ‘dwqa-comment’ type for this field.

    So the issue has nothing to do with PST, sorry. Simply changing ‘dwqa-comment’ to ‘comment’ in the wp_comments database fully solves the problem.

    I let this post available in case it might help someone else.

    Plugin Author John James Jacoby

    (@johnjamesjacoby)

    Hey @ypeynaud, sorry for the silence here. I’m glad you were able to figure things out.

    No reason to be sorry. Lots of plugins and themes do lots of different things, and I think it’s important that everything try to work well with everything else.

    Right now, this plugin doesn’t do anything related to Taxonomies, Comments, or Meta, but that doesn’t mean it won’t later or shouldn’t, especially if it makes life easier for everyone.

    Thank you for posting your experience and feedback here. I really appreciate it.

    Thread Starter ypeynaud

    (@ypeynaud)

    Thank you @johnjamesjacoby for your response! Good if my experience may possibly be useful in some way. It’s really a minimum in exchange to using such a nice plugin.

    Regarding taxonomies, I also had to move some but it was easy through simple bulk-editing. So no real need to be able to translate taxonomies during the switch, although it would have been even more elegant 😉

    Thanks for all.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Strange behaviour with comments: visible on back end but not on front end’ is closed to new replies.