How recent is “recently”?

If you deactivate plugins you can access them some time under the “Recently active” link in the plugin list table.


“Recently” is not a very specific statement. So how long are deactivated plugins assumed to be “recent”? To find this out we have to take a look at the source code. In wp-admin/plugins.php line 166 the option “recently_activated” gets updated if a plugin is deactivated:

if ( ! is_network_admin() )
  update_option( 'recently_activated', array( $plugin => time() ) + 
  (array) get_option( 'recently_activated' ) );

The option contains an associative array containing the path to the main file of the plugin as the key and the time the plugins have been deactivated (as a unix timestamp) stored as a serialized value:

183 recently_activated a:1:{s:21:"hello-dolly/hello.php";i:1357900255;}

Before the plugin table is created the time stamp is used to determine the “recently active” plugins (wp-admin/includes/class-wp-plugins-list-table.php line 76):

$recently_activated = get_option( 'recently_activated', array() );

foreach ( $recently_activated as $key => $time )
  if ( $time + WEEK_IN_SECONDS < time() )
    unset( $recently_activated[$key] );
update_option( 'recently_activated', $recently_activated );

The code is walking through all plugin names stored in "recently_activated" and removes those which are older than one week and saves the others back in the options table.

So the answer to the question is: WordPress defines "recently" as one week.





6 responses to “How recent is “recently”?”

  1. Drew Jaynes Avatar

    That’s good information to know. Let me see if I can find somewhere applicable to put that in the Codex. Thanks!

  2. Tran Ngoc Tuan Anh Avatar

    Interesting experience. I’ve been thinking “recently” = 12 hrs, the same amount of time when WP checks for updates. It should be better if WP lets us change that time (just for fun, because I don’t see any value of that in reality).

  3. Kevin Avatar

    During debugging, I deactivated several and then figured that tab would be an easy place to reactivate them.

    I was wondering why plug-ins that I deactivated several days ago were still in there with the ones I just deactivated. Now I know. 🙂

  4. Michael Scott Avatar

    LOL… I, like many others, just took ‘recently’ for granted never thinking to get a defined time fame. Great tip…I’ll file this under the “Why did I not investigate this sooner” category;)

  5. Roberto Avatar

    Very good post..

  6. Angel Luv Avatar

    To tell you the truth I am not good with scripts and codes but liked to read your post as it increased my knowledge.