Add capabilities via plugin for another plugin
There’s a couple issues here: is_singular() will return false if the function is called before the WP_Query object is set up user_has_cap hook fires early and often – and before WP_Query is set We know that the WP_Query object is set at the wp hook, so you can use that action hook to add a … Read more