Media Library; Limit content to three images


I would like to limit the number of images stored in the 'Media Library' to 'three at any one time'!

Is it possible to do this via a MU-Plugin, please?

Does any body have a piece of 'php code' such that I could use (preferably in a dedicated child-theme's function.php file) to achieve this.!?

It is for use on a 'Multi-site' install, where I do not wish to affect the 'Main Site'!

Thanking you in advance.


  • Lindeni Mahlalela

    Hello John,

    I hope you are doing great today. With our Pro Sites plugin, this is built in as a Pro Sites module called "Post/Page Quotas", I think this is the best option already built for such purposes and I think it will be of great benefit to you.

    If you have Pro Sites already installed, then you can simply go to your dashboard "Pro Sites > Modules" and enable the "Post/Page Quotas" module and save your settings. See screenshot:

    After that go to "Pro Sites > Settings > "Page/Post Quotas" tab, choose a level and set your limits, see screenshot:

    If you didn't use Pro Sites before, you can see the Usage tab in the product page. You can download and install it for free if you have a premium membership.

    If you prefer some code to use in your theme, then you should can get the code from the same pro sites module will will have to copy and modify a few functions and use the code as an mu-plugin to make it take effect in your whole network.

    You can find the code in the file:


    I hope this helps. Please let me know if I have missed something and if you need more help with regards to this.


Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.