Remove your session_start() and at the beginning of your functions.php put this:
if (!session_id()) {
session_start();
}
For use from a plugin use this:
function register_session(){
if( !session_id() )
session_start();
}
add_action('init','register_session');
Related Posts:
- Customizing subject in comment notification e-mails
- Save user total active time after login in wordpress [closed]
- Plugin Hook: Get posts
- Remove H1 title in admin post edit screen
- What are the differences between WPINC and ABSPATH?
- How to save the values of checkbox to the register setting?
- Edit plugin without hooks in functions.php
- Find out what is using PHP sessions in WordPress
- Making plugin unique to not conflict with plugins with the same name
- How to find out if option exists but is empty?
- SESSION in WordPress Plugin Development
- Enqueue style inside shortcode but its loaded at the bottom of page (before footer scripts)
- Good tools for locating hooks in a wordpress page/admin interface/blog post?
- Errors while using ajax from external wordpress page
- Pass A Value From Outside To A Plugin Variable
- shortcode doesn’t work
- Built in admin ajax hooks?
- Is it possible to add an action to the currently running action?
- Deleting images through upload folder, but not deleting from media library
- OOP: Display warning and deactivate the plugin if PHP version is less than 5.4
- How to prevent action in ajax request, when in admin side?
- What are the benefit in adding hook in the init() hook?
- Reposition Woocommerce Message
- Scope for PHP Variables Assigned in functions.php or a plugin
- Where should I save an API key of my user when installing my plugin?
- Prevent a plugin from being automatically activated
- Custom form action to handle data inside a plugin
- Self deactivate plugins after an action occurs
- WP Post Template – Templates in own folder
- Any hook for pre-plugin-update -either bulk or single plugin update
- wordpress plugin is not activating from widget
- How to get all of the activate_plugin action parameters?
- Creating a custom post type, adding custom meta fields, preventing all future editability of posts of this type
- wp_get_post_terms is difference obj model than the one in rest api response
- How to fetch products with the price in a page on woocommerce using a form or live search with php
- Image upload and download from front-end
- Creating a Callback URL for WordPress Woocommerce to update Order Status
- Get Time Taken By Each Action Hook in WordPress
- Ajax call returning 0
- How to deal with WordPress and Pocket API to automate content curation on my hosted wordpress blog? [closed]
- How to replace WordPress Media Upload Window with user’s device window?
- Conditional attributes and logic per product category
- do_action() hook into load-(page)
- Setup wp_schedule_event within a custom plugin
- Issue running db create table query from static method
- execute function after one completed
- How to make multiple admin pages for one plugin?
- Integrating boxtal PHP library into a custom WordPress Plugin
- WooCommerce – set session with new cart item meta when updating cart item quantity [closed]
- Switch from wp-cron to a server cron job
- wp_loaded with static Singleton
- Why is it important to check for isset and is_array before checking in_array in this example?
- Calling a save function from a “submit” button
- Wp Debug Enabled True Notices and Warning
- How to call external functions from a PHP script in a WordPress plugin?
- How to add custom function to pluggable.php
- How to automatically activate users after registration without activation email?
- How to displaying Custom image, text and default image logo from Redux Framework option panel
- Add hook after content without formatting
- i need to make custom cron_schedule with custom interval time as a parameter into a custom payment gateway plugin wordpress
- save_post_product action not firing
- How to get the custom field value using SQL query
- Unexpected add action function in WP plugin
- Prevent WordPress from sending set-cookie http header
- admin_post hook not firing function inside class
- How use wp_insert_post and add og:custom tags?
- Is there any way to sync Facebook Comments and with comments on WordPress website?
- WordPress rewrite rule depend on meta values not ids
- How to change “Read More” text?
- Problem with wordpress has_action() function
- Offering a freemium plugin (a free version + paid version)
- Using id to show item
- Generate and send ICS file through WordPress
- Is admin section completely customizable in terms of styling?
- WordPress Boilerplate Plugin doesn’t see callback functions for add_settings_field and add_settings_section
- Change pricing in Woocommerce based on Category and Product [closed]
- What is the correct entry point for capturing coverage data
- WordPress environment not loading properly
- WordPress not displaying information on post sent from custom admin form
- Creating a user ‘add custom field’ section
- Autoloading a PHP class – working outside, but not inside WordPress plugin
- Display_rows() and column_cb() strange behaviour
- Saving an array to get_options
- Doing action based on input from options menu
- Help me with my first very basic plugin
- How wordpress plugin hooks works? [duplicate]
- Post curl function save twice using plugin hook function wordpress
- My wordpress website admin panel loads very slow, what can i do about that? [closed]
- PHP $_session is not work in wordpress
- How to create post comparison in wordpress
- wp_handle_upload – specified file failed upload test
- How to make a Template page to show the information of different things Shop and Product page?
- How to trigger plugin migration code when plugin updates?
- How to Save Category and Delete Category in same Function
- public custom posts not showing in my wordpress plugin
- add_action() not working for admin
- Error 400 Invalid “products[1].productId” Kinguin [closed]
- WordPress : how to create onglet and remove it when only one
- Plugin question, How to insert a colon in a value box
- Custom page template from plugin does not work with pre-installed themes in WordPress 6.6.1