Title: Need to fix session_start function
Last modified: June 4, 2019

---

# Need to fix session_start function

 *  [Devendra Singh Bhandari](https://wordpress.org/support/users/devendra21986/)
 * (@devendra21986)
 * [7 years ago](https://wordpress.org/support/topic/need-to-fix-session_start-function/)
 * The WP Session Manager plugin is throwing below error:
 * > Another plugin is attempting to start a session with WordPress. WP Session 
   > Manager will not work!
 * I did some research and found the WP Advanced PDF plugin is calling session_start()
   outside of the plugins_loaded hook and running too early that means before loading
   of WP Session Manager plugin.
 * Can you please fix this.
 * thanks

Viewing 1 replies (of 1 total)

 *  Thread Starter [Devendra Singh Bhandari](https://wordpress.org/support/users/devendra21986/)
 * (@devendra21986)
 * [7 years ago](https://wordpress.org/support/topic/need-to-fix-session_start-function/#post-11602260)
 * I have one suggestion here. We can change the current code using function.
 * **Current plugin code:**
 *     ```
       if (!session_id()) {
           session_start();
       }
       ```
   
 * **Start session using plugins_loaded hook:**
 *     ```
       add_action( 'plugins_loaded', 'wp_advanced_pdf_start_session' );
       function wp_advanced_pdf_start_session() {
       	if ( ! session_id() ) {
       		session_start();
       	}
       }
       ```
   

Viewing 1 replies (of 1 total)

The topic ‘Need to fix session_start function’ is closed to new replies.

 * ![](https://ps.w.org/wp-advanced-pdf/assets/icon-256x256.png?rev=1384838)
 * [WP Advanced PDF](https://wordpress.org/plugins/wp-advanced-pdf/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wp-advanced-pdf/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wp-advanced-pdf/)
 * [Active Topics](https://wordpress.org/support/plugin/wp-advanced-pdf/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wp-advanced-pdf/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wp-advanced-pdf/reviews/)

 * 1 reply
 * 1 participant
 * Last reply from: [Devendra Singh Bhandari](https://wordpress.org/support/users/devendra21986/)
 * Last activity: [7 years ago](https://wordpress.org/support/topic/need-to-fix-session_start-function/#post-11602260)
 * Status: not resolved