function wpdocs_advanced_custom_admin_url( $url, $path ) {
// Check if the current user is an administrator
if ( current_user_can( 'administrator' ) ) {
// Check if the user is accessing the plugins page
if ( strpos( $path, 'plugins.php' ) !== false ) {
// Add a different custom query parameter
$url = add_query_arg( 'plugins_param', 'value', $url );
} else {
// Add the default custom query parameter
$url = add_query_arg( 'custom_param', 'value', $url );
}
}
return $url;
}
add_filter( 'admin_url', 'wpdocs_advanced_custom_admin_url', 10, 2 );
You must log in before being able to contribute a note or feedback.
User Contributed Notes