cac/is_cac_screen

Deprecated This documentation is deprecated since Admin Columns version 4.

The filter cac/is_cac_screen determines whether Admin Columns should fully load, including loading column classes and initializing storage models. By default, this is done in content (e.g. posts, users, comments) overview screens, the Admin Columns settings screen and on AJAX calls. It can be used to make sure Admin Columns is loaded on your own custom pages.

Usage

/**
 * Filter whether the current screen is a screen in which Admin Columns is active
 *
 * @param bool $is_cac_screen Whether the current screen is an Admin Columns screen
 */
function my_cac_filter_is_cac_screen( $is_cac_screen ) {
    // Possibly modify $is_cac_screen
    return $is_cac_screen;
}
add_filter( 'cac/is_cac_screen', 'my_cac_filter_is_cac_screen' );

Example

This example ensures Admin Columns is loaded on WPML settings pages. Similar code is used in the Admin Columns core to allow us to set up translations for WPML.

/**
 * This example ensures Admin Columns is loaded on WPML settings pages
 *
 * @param bool $is_cac_screen Whether the current screen is an Admin Columns screen
 */
function my_cac_filter_wpml_is_cac_screen( $is_columns_screen ) {
    if ( isset( $_GET['page'] ) && 'wpml-string-translation/menu/string-translation.php' === $_GET['page'] ) {
        $is_columns_screen = true;
    }
    return $is_columns_screen;
}
add_filter( 'cac/is_cac_screen', 'my_cac_filter_wpml_is_cac_screen' );