How to save contact form 7 data in Custom Post Types (CPT) [closed]

If you want to save the Mail Content after the Contact Form was sent (or failed), you can use the wpcf7_mail_sent and wpcf7_mail_failed Hookes like this: add_action(‘wpcf7_mail_sent’,’save_my_form_data_to_my_cpt’); add_action(‘wpcf7_mail_failed’,’save_my_form_data_to_my_cpt’); function save_my_form_data_to_my_cpt($contact_form){ $submission = WPCF7_Submission::get_instance(); if (!$submission){ return; } $posted_data = $submission->get_posted_data(); //The Sent Fields are now in an array //Let’s say you got 4 Fields in … Read more

Creating wordpress user registration form

You are sending the data from the form directly to TestForm.php file, which is a PHP script outside of WordPress logic. It is and independent script. You could set the form’s action attribute to a empty string, this way the form data is sent to same page that contains the form, which is part of … Read more

Registration form labels – add asterisk

The * appears under the field because the field is inside the label. There doesn’t appear to be any useful filters for this, but you could use one of the hooks to inject some JS on the page that adds the *: required = jQuery( “<span>*</span>” ); required.css(“color”, “red”); jQuery(‘label br’).before( required ); Note: if … Read more

Get user input from a form

Use wp-admin/admin-post.php as form action handler, and bind your custom function as callback to that. A simple example for email updates. We will use a shortcode named [userform] here, but you can use a template too. add_shortcode( ‘userform’, ‘wpse_75723_userform’ ); add_action( ‘admin_post_update_user_email’, ‘wpse_75723_update’ ); /** * Create the form. */ function wpse_75723_userform() { $here = … Read more

I am trying to create a simple frontend form for posting

To post from the front-end you can use wp_insert_post() function. So its simply a matter of a form and processing it the form: <!– New Post Form –> <div id=”postbox”> <form id=”new_post” name=”new_post” method=”post” action=””> <p><label for=”title”>Title</label><br /> <input type=”text” id=”title” value=”” tabindex=”1″ size=”20″ name=”title” /> </p> <p><label for=”description”>Description</label><br /> <textarea id=”description” tabindex=”3″ name=”description” cols=”50″ … Read more

Submitting post to database then redirecting to paypal

Not sure how I ran into this question one year later, but since it is unanswered… Instead of self-submitting the form and then redirecting to Paypal, you can instead have the paypal url as your form’s action, but use Ajax to save the form data before the form is submitted to Paypal. You can also … Read more

WP Login forms action URLs displayed as pretty URLs in browser (ex with Restore Password)

Step 2. However, when I submit an un-matching password, the form is redisplayed and URL is now http://example.com/wp-login.php?action=resetpass&key=xyz&login=zyx. Notice, that action has changed. When I attempt this with an invalid key I get redirected to http://example.com/wp-login.php?action=lostpassword&error=invalidkey. Anyway, the infinite loop is occurring because you are the condition in_array( $action, array(‘rp’, ‘resetpass’) ) remains true for … Read more

Ajax form submission from admin panel

File Upload via Ajax is a bit tricky, but manageable. Add some additional form fields (nonce and ajax_action) to your form in suite_export_import_menu(): function suite_export_import_menu(){ ?> <h2>Suite Report Export/Import </h2> <div id=”export_import_form”> <p id=”custom_ajax_call_process”>Uploading…</p> <p id=”custom_ajax_call_result”></p> <form action=”<?php echo admin_url(‘admin-ajax.php’); ?>” method=”post” enctype=”multipart/form-data” target=”upload_target”> <input type=”hidden” name=”action” value=”export_vacancy”> <input type=”hidden” name=”subaction” value=”imp_vacancy”> <input type=”file” name=”file_source” … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)