Allow Users To Post Ads [adverts_add]
This shortcode is deprecated since WPAdverts version 2.0
Instead, we recommend using blocks – a modern visually customizable alternative to shortcodes.
You can replace this shortcode with the Classifieds / Publish block.
Usually you will want to allow your visitors to post ads, without accessing wp-admin panel, you can do so using [adverts_add] shortcode.
In order to do that go to wp-admin / Pages panel click Add New button or select one of existing pages and inside its content add [adverts_add] code and publish or save it.
Now click “view page” link, the page content should look similarly as on the screenshot below:
Shortcode Parameters
- name: string (default “default”) – this is mainly for future use, the name basically should identify shortcode.
- moderate: int (default 0) – setting value for this parameter to 1 will enable moderation, this means that all ads posted will not be published until administrator will approve them
- requires: string (default null) – required capability post an Ad, for example, if you want any registered user to post Ads set the value to “read” (since 1.1.5).
- requires_error: string (default null) – custom error message displayed when the user does not have the required capability (since 1.1.5).
- skip_preview: int (default 0) – setting skip preview value to “1” will make the shortcode go directly from the Form to Publish/Page step (since 1.4.0)
Example Usage
Add classified form with moderation enabled.
[adverts_add moderate="1"]
Allow only users with Editor or higher to post Ads
[adverts_add requires="edit_pages" requires_error="Only Editors can post Ads."]