Download the PHP package wecodemore/termlimit without Composer
On this page you can find all versions of the php package wecodemore/termlimit. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download wecodemore/termlimit
More information about wecodemore/termlimit
Files in wecodemore/termlimit
Package termlimit
Short Description WordPress plugin to limit the amount of (custom) taxonomy taxons on a per post type basis.
License MIT
Homepage https://github.com/wecodemore/wcm-termlimit
Informations about the package termlimit
WordPress Term Limits
Limits terms (categories, post tags, custom taxonomy terms) on a per post type basis
Do you have lazy authors who don't care using a single tag? Do you have wannabe SEO experts using all of your tags on each post?
Set an end to that. Just like seen on StackOverflow and other StackExchange sites: minimum 1 tag, maximum 5.
(Yes you can define the amount yourself)
Needs PHP 5.4+ to run. Will break with lower PHP versions.
Is this a plugin?
Yes. For WordPress.
How to install?
You can simply download it and are ready to go. Still the following options are preferred.
Or just install/import it into your project using Composer
composer create-project wcm/termlimits
Or clone the repository into your plugin directory using git
git clone [email protected]:wecodemore/wcm-termlimit.git
How to use?
Per default, there is a minimum of 0
terms that need to get added.
The maximum is 3
. And the limit only applies for the post
post type.
To alter the limit or the type, there are two filters that you can use in a small child plugin:
In case you want to extend your limit to custom taxonomies, you will also have to write a quick extension/class to account for that:
To see what exactly you should take as input/$_POST
value, use
the following mini-plugin to dump your save_post
action.
Important: Make sure that you have at least FTP access and can actually edit or remove the plugin. Else you will get stuck there. This will break (exit) your request and present you with a dump of the post.
The @TODO List
Custom taxonomy terms.
Also, there's by now nothing built in to do something in case the limit was exceeded or the needed threshold not reached (min/max taxons). The plugin lets everything go through and just informs the user. One idea so far: extend the notification. The problem with this is that I have no idea what should happen in that case. Should we nuke all added terms? What if 20 are allowed and the user added 21? Should we just cut off one? If yes: Which one? Etc. As you can see, there're a lot of possible UX mine traps and I have by now no idea how to solve them. To be honest: This was just a very quick side project as it is something that is often requested. If you have any idea how to go on this, feel free to open a pull request to discuss your ideas. Thanks in advance.
License
WCM TermLimits is licensed under the MIT. Do whatever you want and feel comfortable with it. Still a tweet or similar and a star here on GitHub won't hurt, right?
All versions of termlimit with dependencies
composer/installers Version ^1
wcm/git-php-hooks Version ^1
wcm/git-php-hooks-library Version ^1