Way to restrict amount of pages that can be created? (2 posts)

  1. Kevin
    Posted 3 years ago #

    Hey guys,

    Does anyone know of a way that enables you to (for example) restrict an account to make a maximum of 5 extra pages on the website?

    So basically put a limit on the amount of pages a user can create (or total amount of pages)

    Or something in that general direction!

    Help would be much appreciated.

  2. bcworkz
    Posted 3 years ago #

    Well, it's possible to query the database for a count of pages by a particular author, so what you want to do is possible. You'll need to find the proper action or filter to hook onto, maybe one that fires when the user opens the new page editor.

    Then your hook function can do the count query, and if the result is more than or equal to 5, it could simply do a wp_die() with an error message.

Topic Closed

This topic has been closed to new replies.

About this Topic