• I was wondering if there is some plugin or something capable of achieving this.

    I want to “Archive” a lot of comments on my site and would like to store them as static HTML pages.

    Is there any tool out there capable of doing this?

    Thanks in advance.

    • This topic was modified 4 years, 6 months ago by Jan Dembowski. Reason: Moved to Fixing WordPress, this is not an Everything else WordPress topic
Viewing 3 replies - 1 through 3 (of 3 total)
  • Moderator bcworkz

    (@bcworkz)

    I’m unaware of such a plugin. Your search skills are likely as good as mine 😛

    What would be possible is to create a comments only template that writes to a file instead of outputting to a browser. Creating HTML files isn’t a very efficient way to archive data. You’re actually better off leaving them in your database. If you like, it’s possible to alter your site’s comments queries to only display newer comments. Older ones would only be accessible through the admin area or some sort of special archived comments front end page.

    Another possible archive solution would be to export the entire comments table from the DB. If they don’t need to be very accessible you could then clear most or all comments from the site. In order to access such archived comments you’d then need to export the current comments table and restore from the previous export file. Export files can be zipped so they take up very little space.

    The best solution depends on how accessible archived comments need to be.

    Thread Starter American2020

    (@american2020)

    @bcworkz Thanks. Sounds like a good idea, I guess I could do something like that and have a template for the “post” displaying only the comments.
    Not sure how much I would have to hardcode parts of this in order to get it working, but will give it a try.

    Moderator bcworkz

    (@bcworkz)

    There is a “pre_get_comments” action where you can add a “date_query” arg array to the object’s query vars to limit how far back WP should get comments.

    Date query array structure is rather convoluted. You may find the date_query examples for posts helpful. It’s the same structure, except applied to comments. Deep linking to the right section doesn’t work right on this page. After the jump find “Date Parameters” in the Contents and follow that link.

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Convert WordPress Comments to HTML’ is closed to new replies.