apply_filters( 'lp__admin_sub_view_param/{admin_page}' )

Allow filter for admin sub views param of specific admin page during its link preparation.


Plugin


Namespace

Launchpad


Parameters

array

$param

Admin sub view URL parameter


Return

array

Filtered sub view URL parameter


Example

Suppose you have an admin page named “Specific Admin Page,” and you want to customize its sub view parameter based on the user’s role. If the user is an administrator, you want to set the sub view parameter to 'admin_sub_view'; otherwise, it should be set to 'user_sub_view'. Here’s how you can achieve that:

add_filter( 'lp__admin_sub_view_param/specific-admin-page', function($param) {
    // Check if the user is an administrator
    if (current_user_can('administrator')) {
        // If the user is an administrator, set the view parameter to 'admin_sub_view'
        $param = 'admin_sub_view';
    } else {
        // If the user is not an administrator, set the view parameter to 'user_sub_view'
        $param = 'user_sub_view';
    }
    // Return the modified parameter
    return $param;
});

After applying this customization, whenever the “Specific Admin Page” is loaded, the view parameter in the URL will be dynamically set based on the user’s role. If the user is an administrator, it will be 'admin_sub_view'; otherwise, it will be 'user_sub_view'. See the results below:

For an admin user:

http://your-domain/wp-admin/admin.php?page=specific-admin-page&view=view-name&admin_sub_view=user-sub-view-name

For a regular user:

http://your-domain/wp-admin/admin.php?page=specific-admin-page&view=view-name&user_sub_view=user-sub-view-name

Related

Allow filter for specific admin pages.

Allow filter for specific admin pages arguments.

Allow filter for all admin sub views arguments.

Allow filter for admin views arguments of specific admin page and view.

Allow filter for admin sub views arguments of specific admin page, view, and sub view.

Allow filter for admin sub views arguments of specific admin page.

Allow filter for specific admin sub view arguments.

Allow filter for admin sub view arguments of specific admin view.

Allow filter for admin sub views param.

Allow filter for admin sub views param of specific admin page and view.

Allow filter for admin sub views param of specific admin page view.

Allow filter for all admin toolbar arguments.

Allow filter for specific admin toolbar arguments.

Allow filter for all admin toolbar arguments.

Allow filter for specific admin toolbar arguments.

Allow filter for all admin views arguments.

Allow filter for admin views arguments of specific admin page and view.

Allow filter for admin views arguments of specific admin page.

Allow filter for specific admin view arguments.

Allow filter for all admin views param.

Allow filter for admin views param of specific admin page.

Allow filtering the button HTML text to render.

Allow filter for customizing the HTML items for contact details.

Allow filter for all field group arguments.

Allow filter for specific field group arguments.

Allow field value filter.

Allow filtering the link HTML text to render.

Allow filtering of template parts to be rendered on a page.

Allow filtering of template parts to be rendered on a page for a specific template.

Allow filtering of template parts to be rendered on a page for a specific template and type.

Allow filter to customize the option of submit button HTML.

Allow filter for the HTML structure of price.

Allow filter for the price HTML arguments.

Allow filter for customizing the HTML items for social media links.