3 comments

  1. the _edit_lock is generated each time you edit a post or page. it consist the timecode and the user. so WordPress is knowing who is currently editing it.

    meta_id     post_id     meta_key    meta_value
    9           5           _edit_lock  1388386997:1
    

    if you manipulate it WordPress reacts somehow sensitive …I tried to fetch how many seconds somebody worked on a post. All the time it broke my database loading time.

    As you said you running this on a large multisite. Don’t know how many users write posts there, but it definitely could break the RAM of the server if to many people edit a post at the same time.

    A solution could be:
    get rid of _edit_lock

    How to disable the “Post Lock/Edit Lock”?

    Normally WordPress should have the “_edit_lock” one per Post. Some databases have the problem generating them every time.

    Like this guy
    http://wordpress.org/support/topic/can-i-remove-_edit_lock-_edit_last-from-wp_postmeta

    His solution was to delete them all.
    To speed it up you can delete them all every night at 3 o’clock in phpMyAdmin with

    DELETE FROM `yourdb`.`wp_postmeta` WHERE `wp_postmeta`.`meta_key` = '_edit_lock'
    

    might be you find a cron job doing exactly that.

  2. try this 🙂

    UPDATE `wp_postmeta` 
        SET `meta_value` = concat(unix_timestamp(),':386')  
        WHERE `post_id`  = 94705 
          AND `meta_key` = '_edit_lock';
    
  3. Ok probably, the easy way is use WP method.

    update_post_meta($post_id, '_edit_lock', time().':'.$user_id);

Comments are closed.