You can create the shortcode like this:
add_shortcode( 'add_fields', 'input_fields' );
function input_fields( $atts ) {
if ( isset( $_POST['gg'] ) ) {
$post = array(
'post_content' => $_POST['content'],
'post_title' => $_POST['title']
);
$id = wp_insert_post( $post, $wp_error );
}
?>
<form method = "post">
<input type="text" name="title">
<input type="text" name="content">
<input type="submit" name="gg">
</form>
<?php
}
It’s just a sample usage, you can check in detail here.
Related Posts:
- Custom form, shortcode, and submit handler
- Simple contact form with field validation
- Raw output (preventing wpautop)
- other shortcodes in Contact form 7 MAILS [closed]
- Form Shortcode not saving data to WP database
- Getting error on submitting form using Ajax with shortcode
- Adding custom form within add_shortcode
- Modifying the wordpress login page and then referencing it with a shortcode problem
- Form processing: How to process form before output and access data from shortcode
- Create shortcode for each form field in contact form 7
- How can I use a plugin shortcode inside of a html form?
- Send Mail with link to current_user
- Contact form code not working. Need help!
- How to display a page dependent on a url parameter supplied by a form/button page?
- WordPress shortcode select option not working [closed]
- Show shortcode without executing it
- How to create a shortcode with 1 parameter (atts)
- How does a shortcode work?
- Run visual composer code in php page
- Remove wptexturize from a shortcode?
- Using shortcode in Post title
- Audio or playlist shortcode condition according to the amount of files on attachment page
- WP_enqueue_script inside shortcode?
- template_redirect to accompany with a shortcode
- Tinymce shortcodes within shortcode contents
- passing multiple parents value into a shortcode
- How do I preview the result of a shortcode in the TinyMCE editor?
- Conditionally loading Facebook PHP SDK in shortcode
- WordPress shortcode doesn’t working on HomePage
- Localization inside shortcode not working
- Font Awesome Icons Won’t Work
- How to Get a part of URL and put in shortcode?
- Woocommerce, ordering products by default on shortcode pages
- detect when shortcode ran for the last time
- How can a shortcode can take the place of the featured image in a post?
- Shortcode for Twitter Bootstrap Collapse
- Is there any inherent difference between add_filter() and add_shortcode() for modifying [caption]?
- get_shortcode_regex() only matches first shortcode
- Different uniqid when calld in wp_localize_script and shortcode
- How do I debug a short code?
- How to type shortcode-like text in WordPress TinyMCE visual editor?
- Does registering multiple shortcodes impact performance?
- Gallery shortcode – change link file image size? (not using default fullsize image)
- How can I hide the Permalink/Shortlink for certain user logged in Users of a certain level?
- add action only if gallery shortcode attribute is equal to?
- How To Conditionally Include A Short Code Depending On The HTTP_REFERER [closed]
- Shortcode for order number [closed]
- Create shortcode in WordPress, using one variable in 3 functions?
- Edit shortcode in post content programatically
- Adding shortcode field to edit gallery / Gallery Settings
- Hide Selection of Text From Archive, but Show on Single Posts
- Function result goes outside div
- Shortcode in my childtheme is not working
- Displaying shortcode in footer
- Displaying shortcode output through Options Framework
- How to Generate html tags using shortcodes?
- Do shortcode that is inserted in a textarea is not displaying properly
- Use another action instead of the shortcode API to display the last time a user logged in
- how to add shortcode in wordpress container [duplicate]
- Get array of shortcodes within string
- Adding a custom field to do_shortcode [closed]
- Clearfix Shortcode
- How and when to include shortcode source files
- Use full size images in a specific gallery
- contact form 7 database short codes [closed]
- how to create a fav icon shortcode?
- How to deal with WordPress bug: can’t use wrapped and unwrapped shortcode on same post
- Video shortcode, option are not rendered
- Auto embeds don’t work for attachment descriptions
- Color on Shortcode insert that creates a button
- shortcode doesnt work on excerpt
- Adding Author URL to Nav Menu via Shortcode
- Displaying an interactive web map on my wordpress site
- Date Shortcode in Image alt and title tags
- access shortcode atts in template part
- May an attribute have no value?
- How to set up posts per page on WP
- SQL query to bulk change short code in all posts
- Display shortcode in text field with wordpress settings api
- How to strip header tags & shortcodes from the_excerpt()
- shortcode display metainformation as linked image
- Unable to make shortcode, what is wrong?
- Push Shortcode parameter to template
- WordPress plugin shortcodes not outputting anything
- WordPress Gallery with ID’s Shortcode not Working
- Featured image with link to post shortcode, image displaying above the post
- How to stop unwanted splits in excerpts when using shortcodes for sliders or players
- How to add meta slider lite or other slider to main page header in pinboard theme
- shortcode change variable base on user
- Inserting shortcode is blanking excerpt – any ideas?
- Escaping a shortcode so it displays as-is [duplicate]
- If do_shortcode is blank, return some message
- Add a short code to a plugin
- Previous/Next with the same category
- I’ve broken the short code for Contact Form 7!
- echo a shortcode in a shortcode code?
- Applying if (get_post_meta) to new shortcode
- Free Add to Cart Button on WooCommerce with Elementor – No Premium [closed]
- wordpress shortcode url decode non Latin character
- Shortcode return vs echo. Return messes with data URLs, echo does not