Remove plugin settings from post creation page for a user role

As you’ve already done, the first step is to contact the plugin author directly.

If it’s a plugin in the .org repo, you can also try asking the question on the plugin’s support page there. Others in the community might see it and help, though that might take awhile. (If it’s not on .org, there may still be public discussion or question boards available, so seek those out.)

The next thing to do is look through the code itself, to see if you can determine how this section is added to the editor, and whether the author provided some built-in way for it to be conditional.

If they did not build in a way to meet your needs, you can either code the change yourself or hire someone to do so. Then you will want to submit this change as a pull request to the author. Best case scenario, they will accept the change and it will become part of the plugin, so you can continue updating it. Worst case scenario, they never accept the change, and you will need to manually add in your change every time the plugin has an update available, or just maintain it as a fork (your own entirely separate version, where you need to make security and compatibility updates yourself) as long as you need the plugin.


More specifically:

You may be able to call remove_action() for that wppb_content_restriction_add_meta_box() function in your own custom plugin. You would then add a new add_action() with your conditional inside it – check if the user has a certain capability – and if it meets your criteria, then re-hook the function.

It depends on where they’ve hooked that function – you’ll need to check, as it may not be init – but here’s some code to get you started. (You’ll need to determine what capability to check for so you’re targeting the users you want; you’ll need to check the hooks and priorities, but this should be close to what you’re looking for.)

<?php
/* Plugin Name: Make Metabox Conditional
*/
// First, remove the action completely
add_action('init', 'wpse_367691_unhook', 11);
function wpse_367691_unhook() {
    remove_action('init', 'wppb_content_restriction_add_meta_box', 15);
}
// Now, add your own action which will include the conditional
add_action('init', 'wpse_367691_rehook, 20);
function wpse_367691_rehook() {
    // If the current user can publish Posts
    // (change this capability to target users who should see the box)
    if(current_user_can('publish_posts')) {
        wppb_content_restriction_add_meta_box();
    }
}
?>

You can then continue updating the original plugin – checking to make sure they don’t change the name of their function or priority, which are likely not to change – and also keep this plugin which only makes the one function conditional.