Filter: wpd_ai_is_wpd_page
Control whether the current admin page is considered an Alpha Insights (WPD) page.
Description
Used to determine if the user is on an Alpha Insights admin screen (e.g. for loading assets or showing notices). By default, the plugin sets this to true when page matches the main menu slug, settings slug, about/help slug, or getting started slug. This filter lets you include or exclude additional pages.
Location
File: includes/wpd-functions.php
Function: wpdai_is_wpd_page()
Parameters
| Parameter | Type | Description |
|---|---|---|
| $bool | bool | Whether the current page is considered an Alpha Insights page (default true when page matches built-in slugs) |
Return
Type: bool
True to treat the current admin page as an Alpha Insights page; false otherwise.
Example Usage
Exclude a custom subpage from WPD assets
add_filter( 'wpd_ai_is_wpd_page', 'exclude_third_party_subpage_from_wpd' );
function exclude_third_party_subpage_from_wpd( $bool ) {
if ( isset( $_GET['page'] ) && $_GET['page'] === 'alpha-insights-third-party' ) {
return false;
}
return $bool;
}
Include a custom admin page as WPD
add_filter( 'wpd_ai_is_wpd_page', 'include_my_alpha_page' );
function include_my_alpha_page( $bool ) {
if ( isset( $_GET['page'] ) && $_GET['page'] === 'my-alpha-extension' ) {
return true;
}
return $bool;
}
Related
- wpd_alpha_insights_menu_items – Add or modify menu items
- wpd_alpha_insights_menu_html – Modify menu HTML