ProfilePress includes an admin bar control feature.
In your custom plugin, increase the priority to maybe PHP_INT_MAX or a value grater than “9999999999999999999999999999999999999999”.
That should fix the issue.
We’re not using the filter in our custom plugin. We use the WP core function show_admin_bar(false) to set the visibility of the admin bar. You should use that function too, instead of overwriting all other plugins/code with the ProfilePress setting value.
Also, the PHP_INT_MAX value is “9223372036854775807”
While your plugin uses the value “9999999999999999999999999999999999999999” (40 digit number that is interpreted as the float value 1.0E+40)
We find the use of the filter better than calling the function.
You could remove our implementation by calling the function below in your code.
remove_filter('show_admin_bar', 'admin_bar_control')
Interesting approach… However, I disagree with that. In my opinion, the function is clearly better than a filter.
For example, your plugin also overrides the admin bar settings of the Divi theme, and of Restrict Content Pro. Possibly also many other plugins conflict with your decision here…
I’ll switch to a different plugin, as I do not want to start coding around those limitations, and it’s uncertain which other conflicts you are unwilling to address.
Heads-up: The correct code snippet to remove the filter requires the correct priority and the correct callback function; it’s more likely
$obj = ProfilePress\Core\AdminBarDashboardAccess\Init:: get_instance();
remove_filter('show_admin_bar', [$obj, 'admin_bar_control'], 9999999999999999999999999999999999999999);
(I have not tested that code; I’m not sure if that priority is actually un-hookable)
Adding the priority is an optional argument.
It is easier for you to switch to using the filter which is more fool-proof instead of the functions than for us to change our code.