Title: Session started and locked without checking
Last modified: August 30, 2016

---

# Session started and locked without checking

 *  Resolved [DevelopMen](https://wordpress.org/support/users/developmen/)
 * (@developmen)
 * [10 years, 5 months ago](https://wordpress.org/support/topic/session-started-and-locked-without-checking/)
 * Hello,
 * Thanks for making this plugin. In the function `mdocs_nonce()` you always start
   the session and then close it for writing.
    Since this function is always executed
   my other plugins can’t write to the session.
 * I’m starting my session in functions.php as follows:
 *     ```
       function register_my_session() {
       	if ( ! session_id() ) {
       		session_start();
       	}
       }
       add_action('init', 'register_my_session');
       ```
   
 * Should your function check if the session already exists and doesn’t get started
   twice? Is locking necessary or is there any workaround?
 * Thanks in advance!
 * [https://wordpress.org/plugins/memphis-documents-library/](https://wordpress.org/plugins/memphis-documents-library/)

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

 *  Thread Starter [DevelopMen](https://wordpress.org/support/users/developmen/)
 * (@developmen)
 * [10 years, 5 months ago](https://wordpress.org/support/topic/session-started-and-locked-without-checking/#post-6852004)
 * This thread is set to resolved. Are there any updates then?
 * For a workaround right now I have commented _session\_write\_close();_ in the
   function `mdocs_nonce()`
 * Thanks!
 *  Thread Starter [DevelopMen](https://wordpress.org/support/users/developmen/)
 * (@developmen)
 * [10 years, 2 months ago](https://wordpress.org/support/topic/session-started-and-locked-without-checking/#post-6852045)
 * Any updates then? My client updated the plugin so my workaround is gone. Are 
   you going to remove that session_write_close(); in the next update?
 *  Plugin Author [bhaldie](https://wordpress.org/support/users/bhaldie/)
 * (@bhaldie)
 * [10 years, 2 months ago](https://wordpress.org/support/topic/session-started-and-locked-without-checking/#post-6852046)
 * actually yes 3.1.4 will have the session_id() check in place, I should be updating
   it sometime today. Please test it out a make sure it works.

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

The topic ‘Session started and locked without checking’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/memphis-documents-library_91918f.
   svg)
 * [Memphis Documents Library](https://wordpress.org/plugins/memphis-documents-library/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/memphis-documents-library/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/memphis-documents-library/)
 * [Active Topics](https://wordpress.org/support/plugin/memphis-documents-library/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/memphis-documents-library/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/memphis-documents-library/reviews/)

 * 3 replies
 * 2 participants
 * Last reply from: [bhaldie](https://wordpress.org/support/users/bhaldie/)
 * Last activity: [10 years, 2 months ago](https://wordpress.org/support/topic/session-started-and-locked-without-checking/#post-6852046)
 * Status: resolved