WPThumbs
Themes Plugins By purpose By industry Best-of lists Fix it guides
Free Plugin by Pantheon Systems v1.4.5

Native PHP Sessions

Use native PHP sessions and stay horizontally scalable. Better living through superior technology.

Native PHP Sessions

The facts

Rating
4.9★ from 16
Active installs
10k+
Price
Free
Last updated
4 Dec 2025
Added
Sep 2014
Requires WP
5.3
Tested up to
WP 6.9.7
Requires PHP
7.4
Downloads
1,405,542

Our analysis

AI-assisted

Native PHP Sessions is a WordPress plugin that allows the use of PHP's native session handlers within the WordPress environment. It is particularly useful for scenarios where PHP sessions are required by a plugin or theme, enabling safe use of PHP $_SESSIONs backed by the WordPress database.

This plugin is suitable for developers who need to implement session management in a distributed environment, especially when the default PHP tempfile storage is not viable. It offers configuration options for session expiration and includes CLI commands for managing session tables.

Best for: Developers needing to manage PHP sessions in WordPress, particularly in multisite environments.

What it does well

  • Implements PHP's native session handlers
  • Backed by the WordPress database
  • Allows safe use of PHP $_SESSIONs
  • Includes CLI commands for session management
  • Free to use from the WordPress.org directory

Where it falls short

  • Requires PHP version 7.4 or higher
  • Limited information on advanced configuration options

Verdict

Native PHP Sessions provides a straightforward solution for integrating PHP sessions into WordPress. It is a practical choice for developers looking to enhance session management capabilities.

From the developer

Pantheon Systems's own description of Native PHP Sessions, lightly tidied.

WordPress core does not use PHP sessions, but sometimes they are required by your use-case, a plugin or theme.

This plugin implements PHP’s native session handlers, backed by the WordPress database. This allows plugins, themes, and custom code to safely use PHP $_SESSIONs in a distributed environment where PHP’s default tempfile storage just won’t work.

Note that primary development is on GitHub if you would like to contribute:

https://github.com/pantheon-systems/wp-native-php-sessions

Configuration

By default the session lifetime is set to 0, which is until the browser is closed.

To override this use the pantheon_session_expiration filter before the Native PHP Sessions plugin is loaded. For example a small Must-use plugin (a.k.a. mu-plugin) could contain:

<?php
function my_session_expiration_override() {
    return 60*60*4; // 4 hours
}
add_filter( 'pantheon_session_expiration', 'my_session_expiration_override' );<h3>CLI Commands</h3>

wp pantheon session add-index

Added in 1.4.0. This command should be run if your installation of the plugin occurred before the addition of the primary ID key to the session table in version 1.2.2. You will be automatically notified when you visit any admin page if this is the case. If there’s no message, your version is good to go. Note that this command is non-destructive, a new table will be created and the existing one preserved in a backup state until you have verified that the upgrade is functioning as expected.

wp pantheon session primary-key-finalize

Added in 1.4.0. If you have run the add-index command and have verified that the new table is functioning correctly, running the primary-key-finalize command will perform a database cleanup and remove the backup table.

wp pantheon session primary-key-revert

Added in 1.4.0. If you have run the add-index command and something unexpected has occurred, just run the primary-key-revert command and the backup table will immediately be returned to being the active table.

WordPress Multisite

Read the full description on the official page →

Tagged as

Alternatives

Other plugins for backups.

All-in-One WP Migration and Backup

Trusted by 60M+ sites: The gold standard for WordPress migration and backup. Migrate, backup, and restore your...

Free 5M+ installs 4.5★ (7,664)
Duplicator

The best WordPress backup and migration plugin. Quickly and easily backup ,migrate, copy, move, or clone your...

Free 1M+ installs 4.9★ (4,929)
WPvivid

WPvivid

93

All-in-one WordPress backup, migration and staging plugin — schedule automatic backups, restore in one click,...

Free 900k+ installs 4.9★ (1,536)
Disable Gutenberg

Disable Gutenberg Block Editor and restore the Classic Editor and original Edit Post screen (TinyMCE, meta box...

Free 500k+ installs 5★ (733)
WP STAGING

WordPress backup plugin: backups, restore &amp; migration in minutes. Clone or duplicate your site, test updat...

Free 100k+ installs 4.8★ (2,464)