Hi there,
I have a custom post type, and would like to limit to "one" the number of time a user can post to the post type.
This is because the post type makes a user profile on the site (submitted from the front end using Toolset Forms), and we want that user profile to be limited to one per user.
I hope you can help.
Many thanks for your time,
Andrew.
It's not possible natively but there is a trick (3, actually) how to achieve that.
1. Create a Toolset Form to create such posts, and put that Toolset Form to a View's loop "no items found"
2. Set the View to display posts by the current logged in user and limit it to 1
3. Put the View on a page
If the view has no results (the user did not submit any such posts) then the "No items found" section is triggered and hence, the form is shown with which the user can submit new posts
1. Or, use custom code
2. Such custom code is shown as an example here:
enlace oculto
==> It also uses Toolset Forms
1. If you do not plan to use Forms, you can count posts by user and use a Custom ShortCode to apply a condition to stop submitting new
2. Such custom code is shown as an example here:
enlace oculto
3. That code can be used as a ShortCode in an HTML condition of Toolset or, if modified, even apply on the save_post hook of WordPress. More information about these 2 details here:
https://toolset.com/documentation/user-guides/conditional-html-output-in-views/
https://codex.wordpress.org/Plugin_API/Action_Reference/save_post
Hi. I do not see the links you give to Andrew in the answer and he also interjects me. Is there any way to see it?