You need to add your code to the functions.php file of your theme. (Actually, adding it to your Child Theme is best, since you don’t want a theme update changing things. Unless you are writing your own theme.)
So this in your functions.php file:
if(!session_id()) {
session_start();
}
Related Posts:
- Display message once per session to users with a specific role
- How to log out everywhere else, destroy all sessions “all other devices”?
- Why does $_SESSION only work when I am logged in?
- how to create and show sessions in word press?
- Should I store my Facebook access tokens?
- Site Health : An active PHP session was detected
- integrating external php library into wordpress- the right way
- How to expire session after 2 hours and also expire when browser closed?
- Fatal Error relating to sessions.php
- How to store post ID’s in cookie or session to display the same posts later
- iframe does not store session/cookie when refresh parent
- Unique session WordPress
- Get my site session in wordpress?
- Having Issue on Redirecting With Session in WordPress
- Unset session variable on page reload / setup but exclude AJAX
- $_SESSION variable not saving on page refresh or new page
- $_SESSION variables work perfectly on my local machine but returns NULL on development webserver
- The session works on the local server, but not on the web server
- Custom $_SESSION expires too early
- Can we stop session reset if page reloads?
- Store and Change Session variable – PHP SESSION VARIABLE
- Deleting expired session tokens in WordPress
- PHP: $_SESSION destroyed after page reload for my custom session
- Set cookie parameters on wp site – PHP not working?
- Are there any drawbacks on opening a session_start in functions.php and header.php?
- Like and Dislike Buttons on Post with Counter – Only allow one click per post per user session
- PHP session not staying alive. headers already sent
- Sessions with WordPress
- Use WP user status (logged_in) to manage access to independent application
- ajax polling with admin-ajax.php
- Allow user to select location and then set cookie for location in WordPress
- How to ‘remember’ a site member’s last visited page?
- White screen after login attempt
- Where are Sessions are being started? [closed]
- WordPress & PHP sessions
- How to transfer session after being redirected to other page
- Suddenly sessions and header location not working
- PHP – Having $_SESSION as an array and adding $_SESSION to array
- How to include checkbox in widget backend form?
- How to hide get_theme_mod if field empty
- renaming an admin menu item with decimal array index number
- How to get the original price of the product in woocommerce?
- How to make sure that only one wp_cron() runs at a time?
- Widgets not showing in my custom theme
- Edit category output
- To echo or not to echo?
- Different background-image by category
- What is the fastest way to load PHP functions that are only used in one theme template?
- Writing scripts using WordPress / WooCommerce classes?
- storing wp_head in a variable?
- Get taxonomy terms only of the WP_Query current posts
- How do I attach a php file to an arbitrary slug and still have access to the wp-core functions?
- Woocommerce redirect thankyou page based on product ID doesn’t empty Cart
- Is_template how to add one more template [closed]
- How to modify URL (add GET values) after front end form submission?
- Error: options page not found
- Filtering a Database Query
- anyway to put inside a $outprint=sprintf()
- Can’t save php string to a custom field
- Appended comments but they show up above the content instead of below
- get_template_directory adding FTP root folders in urls
- Is there any wordpress plugin to upload images and captions to multiple pages once
- Removing the first 8-10 letters from a post?
- Site Health says I’m running an older version of PHP even after I upgraded to 7.4.4
- WordPress REST API register_rest_route give a 500 error
- Where to insert redirect code based on http_referer?
- Trying to get property of non-object in WordPress Breadcrumbs
- Delete database record using plugin from admin panel
- Post not populating for custom post type based on category selection
- How to display success message correctly and delete it when the page is refreshed
- Infinite Loop – WP_Query
- call_user_func_array() expects parameter 1 to be a valid callback, function ‘———-‘ not found or invalid function name
- How can i make a search box to search by custom field
- go to home page when i select default in select-box
- Display Custom Field in Sidebar if Value is Present
- Database entry removed on browser refresh, Ajax PHP jQuery
- Hide specific product from Woocommerce if the logged-in user has already enrolled into the course
- How to find which .mo file is responsible for displaying a particular localized string?
- How to stop hiding buttons forward / backward in pagination?
- Add to cart quantity dynamic
- Infinite looping next post link within a certain category on a post
- Woocommerce textarea format ignored
- Windows Setup: Error establishing a database connection
- Pass product object to javscript
- remove blank space where sidebar was
- WordPress 3.0 PHP Error – notice WordPress_product_Type was called incorrectly
- Retrieving specific images from Media Library
- direct query to post_meta table
- Include administrator in author list
- Pass php to database in JQuery: With AJAX?
- List sibling pages widget, exclude current page
- WP Simple Fields – Single repeatable field inside repeatable field group
- Path for contact form file
- File Upload with Server in safe_mode
- WP plugin updates [duplicate]
- Custom Archive Page
- Load files content [closed]
- Shortcode for Visual Composer Grid fails turning string to integer
- How to limit the number of posts in the wordpress loop in conjunction with the “download more” button?
- WordPress Query – Blog Cards Duplicate issue