wp_mail file attachment not being placed in upload folder?

Attachments should always use the absolute filesystem path. Also to change the Content-Type of the email you should use the wp_mail_content_type filter. <?php function my_custom_email() { $to = ‘[email protected]’; $subject=”WordPress wp_mail”; $message=” <html> <body> <table rules=”all” style=”border-color: #666;” cellpadding=”10″> <tr>Hello WordPress</tr> </table> </body> </html> “; $attachments = array( WP_PLUGIN_DIR . ‘/my-plugin/uploads/sample_photo_01.jpg’ ); $headers[] = ‘From: … Read more

Can you have more than one nonce on a page?

This turned out to be a pretty straightforward bug with my own code. The problem was my first form was checking for submission with a simple: if ( ‘POST’ == $_SERVER[‘REQUEST_METHOD’] ) { so it was being triggered even when the other form was submitted, and my wp_verify_nonce() check would fail and then it would … Read more

How to make front end form only accept certain values

you will probably want to use term_exists http://codex.wordpress.org/Function_Reference/term_exists to check if the term is “valid”. Probably worth checking how good is that API with mismatched cases. Another option is to use AJAX to populated your input control base on the user input. I am almost sure there is some jquery plugin for that, and then … Read more

Styling my own password protected page, how to deal with wrong password?

This worked for me adding this code in functions.php: add_filter( ‘the_password_form’, ‘wpse_71284_custom_post_password_msg’ ); /** Add a message to the password form. @wp-hook the_password_form @param string $form @return string */ function wpse_71284_custom_post_password_msg( $form ) { // No cookie, the user has not sent anything until now. if ( ! isset ( $COOKIE[ ‘wp-postpass‘ . COOKIEHASH ] … Read more

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