How Do I Create a Post Submit Form in WordPress?
Creating a post submit form in WordPress is easy. First, you’ll need to create a new file in your WordPress site called wp-post-form.
php. In this file, you’ll need to include the following PHP code:.
__( ‘Post Submit Form’ ), ‘description’ => __( ‘This is a form to allow users to submit new posts.’ ), ‘public’ => true, ‘rewrite’ => array( ‘slug’ => ‘submit-post’, ‘with_items’ => false, ‘supports’ => array( ‘title’ ), ‘taxonomies’ => array( ‘your_taxonomy’ ), ‘has_archive’ => true, ‘supports_media’ => true, ‘has_date’ => true, ‘use_shortcode’ => true, ‘has_discussion’ => true, ‘has_form’ => true, ‘use_custom_fields’ => true, ‘supports_translations’ => true, ‘has_custom_fields’ => true, ‘supports_js’ => true, ‘has_form_field’ => true, ‘use_custom_fields_callback’ => true, ‘access_level’ => ‘public’, ‘cache_expiry’ => ’60’, ‘default_value’ => ”, ), ‘public’ => true, ‘rewrite’ => array( ‘slug’ => ‘submit-post’, ‘with_items’ => false, ‘supports’ => array( ‘title’ ), ‘taxonomies’ => array( ‘your_taxonomy’ ), ‘has_archive’ => true, ‘supports_media’ => true, ‘has_date’ => true, ‘use_shortcode’ => true, ‘has_discussion’ => true, ‘has_form’ => true, ‘use_custom_fields’ => true, ‘supports_translations’ => true, ‘has_custom_fields’ => true, ‘supports_js’ => true, ‘has_form_field’ => true, ‘use_custom_fields_callback’ => true, ‘access_level’ => ‘public’, ‘cache_expiry’ => ’60’, ‘default_value’ => ”, ), ‘title’ => __( ‘Post Submission Form’ ), ‘meta_key’ => ‘submit-post’, ‘meta_value’ => ‘Submit a new post’, ‘admin_label’ => ‘Post Submit Form’, ‘admin_title’ => ‘Post Submission Form’, ‘show_in_nav_menus’ => true, ‘public’ => true, ‘rewrite’ => array( ‘slug’ => ‘submit-post’, ‘with_items’ => false, ‘supports’ => array( ‘title’ ), ‘taxonomies’ => array( ‘your_taxonomy’ ), ‘has_archive’ => true, ‘supports_media’ => true, ‘has_date’ => true, ‘use_shortcode’ => true, ‘has_discussion’ => true, ‘has_form’ => true, ‘use_custom_fields’ => true, ‘supports_translations’ => true, ‘has_custom_fields’ => true, ‘supports_js’ => true, ‘has_form_field’ => true, ‘use_custom_fields_callback’ => true, ‘access_level’ => ‘public’, ‘cache_expiry’ => ’60’, ‘default_value’ => ”, ), ‘custom_fields’ => array( ‘name’ => ‘Name’, ’email’ => ‘Email’, ‘phone’ => ‘Phone Number’, ‘message’ => ‘Message’ ), ‘custom_fields_callback’ => ‘wp_post_form_custom_fields_callback’, ), );
Next, you’ll need to create a new file in your WordPress site called wp-post-form-fields.php. In this file, you’ll need to include the following PHP code: