Alway send submissions to the page the form is displayed. In your shortcode callback you can then display proper error or success messages.
Sample:
add_shortcode( 'classifiedsform', 'classifiedsform_callback' );
function classifiedsform_callback()
{
if ( 'POST' !== $_SERVER['REQUEST_METHOD']
or ! isset ( $_POST['classifieds'] )
)
{
return classifieds_input_form();
}
// process input show errors or success message
}
function classifieds_input_form()
{
// return a string with the form HTML
}
Make sure you don’t use a reserved variable or WordPress will drop the content silently.
Related Posts:
- Form action/link to render a plugin in WordPress front-end
- Where to put my code: plugin or functions.php?
- Create a shortcode to display custom post types with a specific taxonomy
- Get post ID from wp_insert_post()
- Display custom post type with shortcode
- Create page to handle form submission
- Add Content to Page without shortcodes
- How can I fix those issues generated by the Themecheck plugin
- Shortcode Displaying Custom Post Types
- WordPress Custom Shortcode Conflicting with Media Library
- How to save contact form 7 data in Custom Post Types (CPT) [closed]
- Conditional two level dropdown filter for custom post type
- Dynamic dropdown custom post list based on dropdown selection
- Reason action hook won’t work with update_post_meta from frontend form? Alternative?
- How can I fix a slow redirect after form submit from frontend (no plugin)?
- How to embed form data within the ‘Add new post’
- Custom Select Query with Custom Post Types
- How can i list custom post type categories?
- IF statement in a do_shortcode
- Linking three taxonomies with ACF
- Custom query form submission pagination
- Post the content of a specific “Custom Post Type” post within a post using a shortcode
- Strip shortcode from specific post types (formats)
- Pagination in a Shortcode. Get_next_posts_link not working but get_previous_posts_link works fine right next to it
- Why does using WP_Query inside a shortcode in an elementor page cause the arguments for WP_Query to get malformed?
- Generate Shortcodes by Taxonomy
- How would I create a shortcode to display a custom post within a page or regular post?
- How to add the post ID (or any other post data) to a Contact Form 7 mail?
- Is it possible to create a shortcode that will query a post based on taxonomies?
- WordPress posts with multiple fields
- WP_Query is printing out only one post when posts_per_page is set to multiple
- How to Submit Post Via cURL & PHP
- Get custom posts with certain ids in a custom loop using a shortcode
- Custom Post Type Loop within Shortcode
- Shortcode insertion in tab
- Shortcode doesn’t display in custom post type
- Add category attribute to custom shortcode
- Send email button in custom post type backend
- How to display Custom Post Type Post based on Tag with Shortcode Parameter?
- How to create shortcode to display custom field value on a custom post type
- How to query custom post types posts filtered by multiple custom taxonomies through a form selection
- How to enable shortcodes in a custom post type?
- Get custom fields from a custom post type with a shortcode
- Shortcode for display posts in wp-editor
- Display Recently Added Custom Post Types with Custom Taxonomy Shortcode
- How to retain $_POST data when submitting form to custom page
- Display users uploaded files as posts
- Post form as custom post
- Get custom post type list for every category shortcode
- Using advanced custom fields from one custom post type in another custom post type / using nested shortcodes
- How to render a custom post type template with custom fields using shortcode
- custom post type category count shortcode
- Display Child Pages of Custom Post Type Parent Page
- Shortcode to display Staff post type based on Location post type and Specialty post type
- How to integrate a form (Ninja Form or Contact Form 7) with Custom Post Types?
- A form that can save/edit after first input
- wp_reset_postdata() and wp_reset_query() inside shortcode are not working to reset original page query
- Shortcode for CPT post content in a page
- Next Post links not working in custom post type shortcode
- How to make front end form only accept certain values
- Foreach inside shortcode not working as planned
- Edit Custom Post Type on Custom Admin Page instead Post Admin
- Using POST method in meta box, no results
- Form action doesn’t work if slug isn’t same as custom post title
- Can a shortcode included in post content add styles to the ?
- How to retrieve category of a post in have_post loop?
- 404 Error on form submission within custom post type
- Checking if looped item has a parent inside a shortcode
- show custom value from frontend form in a post (custom post type)
- get_post_meta is not working inside shortcode
- the_post() is printing titles in page footer
- Add custom attributes to a post
- Shortcode leaves no space for other elements?
- How can I add a shortcode to query Custom Post Type with ACF in WordPress?
- Custom shortcode works in Elementor editor but not on frontend
- Get Posts by Category, Tag , and CPT Taxonomy
- post_type internal ID?
- Custom post type Shortcodes wordpress
- how to create custom post type with dynamic category_name using shortcode
- Add shortcode inside of the_content()
- WordPress Custom Post Type and Shortcode for Portfolio Items
- Run shortcode in custom script in wp_head if post type is CPT ‘Jobs’
- Creating shortcode id for custom post types
- Shortcode is displaying the content on top of the page [duplicate]
- Filter content in shortcode
- Shortcode with WP_Query more than once on one page
- posts within custom post type all share the same content in the front-end
- Shortcode to return single custom post based on post taxonomy
- Change post type depending on shortcode
- Custom Post Type for Shortcode Use – Prevent it display as a post (with slug)
- Direct form to a custom page template
- How to call a post’s metadata in shortcode.php?
- Looking to Customize YouTube Video Embeds
- Trying to write shortcode with get_post_meta but isn’t working
- How to selected value default in option list?
- Shortcode / WP_Query in post changes context
- How to display class name in this shortcode post query
- Custom Post Type or Shortcode, What to choose? [closed]
- Modify a plugin function output from another plugin
- Problems making shortcode with custom post types and taxonomy