Multiple post meta SQL entries for `_members_access_role`

Members 3 posts 2 voices

  1. Hello!

    I noticed a potential database bloat problem with the Members plugin.

    Indeed, anytime I save a post with members access settings, it saves a new post meta entry in my database for this post, even if the post already has the matching post meta.

    Example screen capture for the post #14398:

    Is this the expected behavior?

    Does anyone know a quick way to delete extra entries?

    Thanks a lot in advance for your help 🙂

  2. That was a bit weird. I’ll include a fix in the next version of Members. If you want to patch it yourself right now, got to the admin/class/meta-box-content-permissions.php file in the plugin and look for line 194, which should look like this:

    // Fix for attachment save issue in WordPress 3.5.

    Just above that line, add the following code:

    $do_autosave = defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE;
    $is_autosave = wp_is_post_autosave( $post_id );
    $is_revision = wp_is_post_revision( $post_id );
    if ( $do_autosave || $is_autosave || $is_revision )

    As for deleting the extra entries, unticking the box for the role should delete any entries with that value. Then, retick the box after saving.

  3. Thank you so much for your help, Justin! It works effortlessly.