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, 6 months ago](https://wordpress.org/support/topic/session-started-and-locked-without-checking-1/)
 * 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 1 replies (of 1 total)

 *  Plugin Author [bhaldie](https://wordpress.org/support/users/bhaldie/)
 * (@bhaldie)
 * [10 years, 6 months ago](https://wordpress.org/support/topic/session-started-and-locked-without-checking-1/#post-6851841)
 * thanks for the info ill test this methodology, on issue I’ve looking at is the
   closing of the session. If I am testing for a session already open then closing
   it would create problems.

Viewing 1 replies (of 1 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/)

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