Forums

Make All Of An Author's Posts Private (8 posts)

  1. ampersand
    Member
    Posted 3 years ago #

    One author on my blog, who has written about 129 posts, has asked me to remove all of her posts from the blog.

    Is there any way to bulk-change all of this particular author's posts to "private," so I can in effect remove them from the blog, without losing all that data? This way, if the author later changes her mind, I could restore them.

    Thanks!

  2. ampersand
    Member
    Posted 3 years ago #

    Even better, is it possible for me to replace the text of all this author's posts (for example, with text saying "post removed by request of author") while keeping the post links and the comments following all these posts intact? It's hundreds of comments, so I'd like to keep them available while removing the post contents, if that's possible.

  3. Kafkaesqui
    Moderator
    Posted 3 years ago #

    Set all posts by author to private

    If you have access to your database through a tool like PHPMyAdmin, you can use a single UPDATE query to reset all their posts to private:

    UPDATE wp_posts SET post_status = 'private' WHERE post_author = 10;

    If you're using a different table prefix ('wp_' in the above query), change wp_posts to reflect that. And make certain to use the correct user/author ID for the WHERE post_author clause.

    Replace the text of all this author's posts

    A plugin for this would be trivial to write. If you're game, I can put one online...

  4. ampersand
    Member
    Posted 3 years ago #

    If you could write the plugin (and if it really is that easy to write) I'd very much appreciate it.

  5. Kafkaesqui
    Moderator
    Posted 3 years ago #

    All righty then...

    Post Content Concealer plugin
    Download plugin | View source

    The plugin has two user-configurable variables you should know about:

    $authors = The author/user ID(s) for those with posts you want to 'conceal.' Just separate multiple IDs with commas ('1, 2, 3'). This one needs to be set before activating the plugin; '5000' is set as default, which you can just edit out.

    $message = Replaces post content. Functions as a notice of sorts to inform visitors the post text is gone. Default is: '<p>This post was removed by request of the author.</p>'

    You can change these variables either through the Plugin Editor in WordPress, or in a text editor offline.

  6. ampersand
    Member
    Posted 3 years ago #

    Thank you very much!

    I have a follow-up question: Does this plug-in permanently delete the original post content, or would it be possible to "undo" this in a year or two, if the authors who want their content removed change their minds?

    (If it's not possible, that would still be okay; I still have the data in my most recent back-up, after all, so it would theoretically be possible to restore the data via the backup).

    Thanks again!

  7. Kafkaesqui
    Moderator
    Posted 3 years ago #

    "Does this plug-in permanently delete the original post content"

    No. It merely 'intercepts' it before it goes out to your blog. The content remains in the database and will still be available to the author (or an editor/admin) under the Manage section.

    Removing the author ID(s) from the $authors value, or deactivating the plugin, returns things back to normal.

  8. ampersand
    Member
    Posted 3 years ago #

    It works great! Thank you once again.

Topic Closed

This topic has been closed to new replies.

About this Topic