---
title: "Hooks &amp; Filters"
description: "Below is a detailed description of the action hooks and filter hooks available in the Version Info plugin, tailored for advanced developers. Each hook includes its name, purpose, and usage example."
url: "https://docs.versioninfoplugin.com/advanced-configuration-hooks-and-filters/"
---
Below is a detailed description of the action hooks and filter hooks available in the Version Info plugin, tailored for advanced developers. Each hook includes its name, purpose, and usage example.

# Hooks & Filters

### Action Hooks

1.  **`vi_fs_loaded`**
2.  **Purpose**: Fires when the Freemius SDK is fully loaded and initialized.
3.  **Usage**: Use this hook to safely interact with the Freemius SDK instance for custom license checks or feature gates.
4.  **Example**:
    
    \`\`\`php add\_action( 'vi\_fs\_loaded', 'check\_version\_info\_license' );
    
    function check\_version\_info\_license(): void { // Freemius SDK is now available if ( function\_exists( 'vi\_fs' ) && vi\_fs()->is\_paying() ) { // Custom logic for paying users } } ` `` 2. ** `version\_info\_version\_changed\` **\*** Purpose**: Fires when a version change is detected for WordPress, PHP, MySQL, a plugin, or a theme. \*** Usage**: Execute custom logic in response to environment changes, such as logging, notifications, or triggering maintenance scripts. \*** Example\*\*:
    
    \`\`\`php add\_action( 'version\_info\_version\_changed', 'log\_version\_changes' );
    
    function log\_version\_changes( array $changes ): void { foreach ( $changes as $change ) { error\_log( sprintf( '\[Version Info\] %s changed from %s to %s at %s', $change\['type'\], $change\['old\_version'\], $change\['new\_version'\], current\_time( 'mysql' ) ) ); } } ` `` 3. ** `version\_info\_before\_resource\_render\` **\*** Purpose**: Fires before the System Resources tab content is rendered on the settings page. \*** Usage**: Add custom content or notices above the resource monitoring section. \*** Example\*\*:
    
    \`\`\`php add\_action( 'version\_info\_before\_resource\_render', 'add\_resource\_notice' );
    
    function add\_resource\_notice(): void { echo '
    
    Resource data refreshes every 60 seconds.
    
    '; } ` `` 4. ** `version\_info\_after\_resource\_render\` **\*** Purpose**: Fires after the System Resources tab content is rendered. \*** Usage**: Append custom metrics or additional information below the built-in resource display. \*** Example\*\*:
    
    \`\`\`php add\_action( 'version\_info\_after\_resource\_render', 'add\_custom\_metric' );
    
    function add\_custom\_metric(): void { echo '
    
    ### Custom Metric
    
    '; echo '
    
    Disk Usage: ' . esc\_html( disk\_free\_space( '/' ) ) . ' bytes free
    
    '; } ` `` 5. ** `version\_info\_render\_tab\_{$tab\_id}`** * **Purpose**: Dynamic hook for rendering custom tab content. Replace`{$tab\_id}\` with your tab's slug. \* **Usage**: Register and render entirely custom tabs on the Version Info settings page. \* **Example**:
    
    \`\`\`php // First, add the tab add\_filter( 'version\_info\_settings\_tabs', 'add\_custom\_tab' );
    
    function add\_custom\_tab( array $tabs ): array { $tabs\['my\_custom\_tab'\] = 'My Custom Tab'; return $tabs; }
    
    // Then, render its content add\_action( 'version\_info\_render\_tab\_my\_custom\_tab', 'render\_custom\_tab' );
    
    function render\_custom\_tab(): void { echo '
    
    ## Custom Tab Content
    
    '; echo '
    
    This is a custom settings tab.
    
    '; } \`\`\`
    

### Filter Hooks

1.  **`version_info_footer_details`**
2.  **Purpose**: Filters the version string displayed in the admin footer.
3.  **Usage**: Modify, append to, or completely replace the footer output.
4.  **Example**:
    
    \`\`\`php add\_filter( 'version\_info\_footer\_details', 'append\_hostname\_to\_footer' );
    
    function append\_hostname\_to\_footer( string $footer ): string { return $footer . ' | Server: ' . gethostname(); } ` `` 2. ** `version\_info\_admin\_bar\_nodes\` **\*** Purpose**: Filters the array of admin bar nodes before they are rendered. \*** Usage**: Add, remove, or reorder the version info nodes in the admin bar. \*** Example\*\*:
    
    \`\`\`php add\_filter( 'version\_info\_admin\_bar\_nodes', 'add\_custom\_admin\_bar\_node' );
    
    function add\_custom\_admin\_bar\_node( array $nodes ): array { $nodes\[\] = \[ 'id' => 'vi-disk-space', 'title' => 'Disk: ' . size\_format( disk\_free\_space( '/' ) ), \]; return $nodes; } ` `` 3. ** `version\_info\_dashboard\_widget\_items\` **\*** Purpose**: Filters the array of items displayed in the Dashboard Widget. \*** Usage**: Add custom data points to the dashboard widget. \*** Example\*\*:
    
    \`\`\`php add\_filter( 'version\_info\_dashboard\_widget\_items', 'add\_widget\_item' );
    
    function add\_widget\_item( array $items ): array { $items\['uptime'\] = \[ 'label' => 'Server Uptime', 'value' => shell\_exec( 'uptime -p' ), \]; return $items; } ` `` 4. ** `version\_info\_wp\_version\` **\*** Purpose**: Filters the WordPress version string before display. \*** Usage**: Append additional context or modify the version format. \*** Example\*\*:
    
    \`\`\`php add\_filter( 'version\_info\_wp\_version', 'annotate\_wp\_version' );
    
    function annotate\_wp\_version( string $version ): string { return $version . ' (Multisite)'; } ` `` 5. ** `version\_info\_php\_version\` **\*** Purpose**: Filters the PHP version string before display. \*** Example\*\*:
    
    `php add_filter( 'version_info_php_version', function ( string $version ): string { return $version . ' (' . php_sapi_name() . ')'; } );` 6. **`version_info_mysql_version`** \* **Purpose**: Filters the MySQL version string before display. \* **Example**:
    
    `php add_filter( 'version_info_mysql_version', function ( string $version ): string { if ( str_contains( $version, 'MariaDB' ) ) { return $version . ' (MariaDB)'; } return $version; } );` 7. **`version_info_server_software`** \* **Purpose**: Filters the web server software string before display. \* **Example**:
    
    `php add_filter( 'version_info_server_software', function ( string $server ): string { // Simplify the server string if ( str_contains( $server, 'Apache' ) ) { return 'Apache'; } return $server; } );` 8. **`version_info_settings_tabs`** \* **Purpose**: Filters the array of settings page tabs. \* **Usage**: Add custom tabs to the Version Info settings interface. \* **Example**: See the `version_info_render_tab_{$tab_id}` action hook above for a complete example. 9. **`version_info_system_export_data`** \* **Purpose**: Filters the data array before it is encoded as JSON for the System Export download. \* **Usage**: Add custom sections or remove sensitive data from the export. \* **Example**:
    
    \`\`\`php add\_filter( 'version\_info\_system\_export\_data', 'customize\_export' );
    
    function customize\_export( array $data ): array { $data\['custom'\] = \[ 'hosting\_provider' => 'Kinsta', 'cdn' => 'Cloudflare', \]; return $data; } ` `` 10. ** `version\_info\_allowed\_roles\` **\*** Purpose**: Filters the array of user roles that can view version information. \*** Usage**: Programmatically grant or restrict access for specific roles. \*** Example\*\*:
    
    ` ```php add_filter( 'version_info_allowed_roles', function ( array $roles ): array {     // Also allow shop managers to see version info     $roles[] = 'shop_manager';     return array_unique( $roles ); } ); ``` `
    
    1.  **`version_info_cache_ttl`**
    2.  **Purpose**: Filters the default cache TTL for CPU and memory resource data.
    3.  **Default**: 60 seconds.
    4.  **Example**:
        
        `php add_filter( 'version_info_cache_ttl', function ( int $seconds ): int { return 120; // Update every 2 minutes } );` 12. **`version_info_db_cache_ttl`** \* **Purpose**: Filters the cache TTL for database size data. \* **Default**: 43200 seconds (12 hours). \* **Example**:
        
        `php add_filter( 'version_info_db_cache_ttl', function ( int $seconds ): int { return 3600; // Cache DB size for 1 hour } );`
        

* * *

This section provides advanced developers with a detailed understanding of the available hooks and filters in the **Version Info** plugin. If you need further elaboration on any specific hook or filter, feel free to [contact support](https://versioninfoplugin.com/support/).
