{"id":2391,"date":"2026-10-20T08:32:20","date_gmt":"2026-10-20T07:32:20","guid":{"rendered":"https:\/\/wpgeodirectory.com\/documentation\/article\/limit-listings-per-user\/"},"modified":"2026-10-20T08:41:00","modified_gmt":"2026-10-20T07:41:00","slug":"limit-listings-per-user","status":"publish","type":"gd_place","link":"https:\/\/wpgeodirectory.com\/documentation\/article\/how-tos\/limit-listings-per-user\/","title":{"rendered":"How to limit the number of listings a user can add"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Each GeoDirectory post type has a Limit Posts Per User setting. Set it to 1 and every user can add one listing of that type, or use any other number.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Set a limit for a post type<\/h2>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Go to Places &gt; Settings &gt; General, or the Settings menu of the post type you want to limit.<\/li>\n\n\n\n<li>Click Show Advanced if you do not see all the settings.<\/li>\n\n\n\n<li>Enter a number in Limit Posts Per User. Leave it blank or enter 0 for no limit. Enter -1 to stop users adding listings of this type at all.<\/li>\n\n\n\n<li>Save.<\/li>\n<\/ol>\n\n\n\n<p class=\"wp-block-paragraph\">When a user reaches the limit, the add listing page shows a message instead of the form. The count covers the user&#8217;s listings in that post type, not only the published ones. Administrators are never limited.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The limit applies to logged in users. If you allow guests to add listings, they are not counted.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Different limits for different user roles<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">To give each role its own limit, use the <code>geodir_cpt_posts_limit<\/code> filter. This example allows subscribers one place and authors ten, and leaves everyone else on the post type setting. Change the post type and the roles to suit your site:<\/p>\n\n\n\n<pre class=\"wp-block-prismatic-blocks\"><code class=\"language-php\">add_filter( &#039;geodir_cpt_posts_limit&#039;, &#039;my_listing_limit_by_role&#039;, 10, 2 );\nfunction my_listing_limit_by_role( $limit, $args ) {\n\tif ( empty( $args&#091;&#039;post_author&#039;&#093; ) || $args&#091;&#039;post_type&#039;&#093; !== &#039;gd_place&#039; ) {\n\t\treturn $limit;\n\t}\n\n\t$user = get_userdata( (int) $args&#091;&#039;post_author&#039;&#093; );\n\tif ( ! $user ) {\n\t\treturn $limit;\n\t}\n\n\t$role_limits = array(\n\t\t&#039;subscriber&#039; =&gt; 1,\n\t\t&#039;author&#039;     =&gt; 10,\n\t);\n\n\tforeach ( $role_limits as $role =&gt; $role_limit ) {\n\t\tif ( in_array( $role, (array) $user-&gt;roles, true ) ) {\n\t\t\treturn $role_limit;\n\t\t}\n\t}\n\n\treturn $limit;\n}<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Add it with the <a href=\"https:\/\/wpgeodirectory.com\/documentation\/article\/useful-plugins\/code-snippets-plugin\/\">Code Snippets plugin<\/a> or your child theme&#8217;s functions.php.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The limit is per account, so someone who really wants more listings can still register a second account.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Each GeoDirectory post type has a Limit Posts Per User setting. Set it to 1 and every user can add one listing of that type, or use any other number. Set a limit for a post type When a user reaches the limit, the add listing page shows a message instead of the form. The [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"article\/tags":[],"article\/categories":[432,211],"class_list":["post-2391","gd_place","type-gd_place","status-publish","hentry","gd_placecategory-how-tos","gd_placecategory-tips-tricks-more"],"_links":{"self":[{"href":"https:\/\/wpgeodirectory.com\/documentation\/wp-json\/wp\/v2\/article\/2391","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wpgeodirectory.com\/documentation\/wp-json\/wp\/v2\/article"}],"about":[{"href":"https:\/\/wpgeodirectory.com\/documentation\/wp-json\/wp\/v2\/types\/gd_place"}],"author":[{"embeddable":true,"href":"https:\/\/wpgeodirectory.com\/documentation\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/wpgeodirectory.com\/documentation\/wp-json\/wp\/v2\/comments?post=2391"}],"version-history":[{"count":2,"href":"https:\/\/wpgeodirectory.com\/documentation\/wp-json\/wp\/v2\/article\/2391\/revisions"}],"predecessor-version":[{"id":2696,"href":"https:\/\/wpgeodirectory.com\/documentation\/wp-json\/wp\/v2\/article\/2391\/revisions\/2696"}],"wp:attachment":[{"href":"https:\/\/wpgeodirectory.com\/documentation\/wp-json\/wp\/v2\/media?parent=2391"}],"wp:term":[{"taxonomy":"gd_place_tags","embeddable":true,"href":"https:\/\/wpgeodirectory.com\/documentation\/wp-json\/wp\/v2\/article\/tags?post=2391"},{"taxonomy":"gd_placecategory","embeddable":true,"href":"https:\/\/wpgeodirectory.com\/documentation\/wp-json\/wp\/v2\/article\/categories?post=2391"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}