Am using a third party plugin(eg. ABC Plugin). And their code doesn't have any hooks or filters. And they don't provide customization based on our requirements.
So if I modify the plugin code, I would have to duplicate the changes each time when an update is available for that plugin.
Hence I decided to create a plugin, that will work along with the other plugin, and make the necessary modifications.
Right now, I want to limit the access to a specific url of the plugin page (in admin panel), only to a specific user type.
And the url is like https://mywebsite.com/wp-admin/admin.php?page=abcplugin&route_name=customers__index
Am thinking to use the admin_init
hook to check whether the current requested url is the above, by simply doing if( $_GET['page']=='abcplugin') && $_GET['route_name']=='customers__index')
But am not sure how to show the You do not have permission to access this page
error message. Any inputs?