creating form for wp_remote_post

You could make the form action be the current page’s URL. When the user submits the form the page gets reloaded with the POST parameters. Then in your widget’s code you check if those parameters exist. If so, you check them and then process them with your wp_remote_post. Personally I use Gravity Forms for stuff … Read more

How to implement a custom password field that redirects to another page upon correct password?

The problem is that WP will redirect to the referrer when the authentication succeeds. Fortunately, you can also supply _wp_http_referer and it will be preferred over the HTTP Referrer, so we need to add a hidden field to the form and fill it with the permalink of the post in question: echo str_replace(‘</form>’, ‘<input type=”hidden” … Read more

Customize reset password form redirect problem

You can add the following to your functions.php to achieve what you are after. The action init doesn’t seem to fire in time for what you are looking for. if($_GET[‘action’]===’rp’ && strpos($_SERVER[‘REQUEST_URI’],’wp-login.php’)) { $key = isset( $_GET[‘key’] ) ? $_GET[‘key’] : ”; $login = isset( $_GET[‘login’] ) ? $_GET[‘login’] : ”; wp_redirect( site_url( ‘/reset-password/’ ) … Read more

jQuery Ajax passing empty parameters to my function?

The values are not passed as parameters, but passed in the $_POST array. You need to add nonce for security using check_ajax_nonce https://developer.wordpress.org/reference/functions/check_ajax_referer/ You need to sanitize values submitted before inserting into database Here’s how this should be done: add_action( ‘wp_ajax_send_projectmessage’, ‘send_projectmessage’ ); function send_projectmessage() { global $wpdb; check_ajax_referer( ‘send_projectmessage’, ‘send_projectmessage_nonce’ ); $projectid = sanitize_text_field( … Read more

How to make a search form?

When you code get_search_form() WP search searchform.php in your theme root and print all inside that file. And you can create searchform.php inside your theme root and insert this: <form role=”search” method=”get” action=”<?php echo home_url(“https://wordpress.stackexchange.com/”); ?>”> <fieldset> <input type=”text” name=”s” value=”<?php the_search_query(); ?>”> <button></button> </fieldset> </form> That basic search form. Then code <?php get_search_form() ?> … Read more

Saving checkbox/option list status?

This is really just an html question, not specific to WordPress. Look into checked=”checked” (for check boxes) or selected=”selected” (for selects, radio buttons, etc.) In your case, <input type=”checkbox” name=”showS” value=”true” <?php if (get_option(‘showS’)==true) echo ‘checked=”checked” ‘; ?>> Since this is WordPress, though, I should also be reminding you to use the Settings API where … Read more

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