How to add a custom role in WordPress so that those users can only add posts and do nothing else.

Problem Statement:

If you use the inbuilt roles like Contributor, Author, Editor, etc.
—the dashboard, comments, WordPress logo, etc are visible in the Top Admin bar
—You can make the Top Admin bar totally visible or invisible according to the role but doing so element-wise is not possible.
—Even if you hide the elements in the Admin bar using code in your theme’s functions.php file, a logged-in user can append /wp-admin and access Dashboard and a whole lot of features like comments, etc. Some plugins allow any logged in user to delete/edit all data in that plugin (e.g. QuotesCollection). A non-Admin can thus delete the whole plugin data.

Solution:
Download the below file. Full solution.

Leave a Comment