WordPress get_the_content losing formatting when emailed

The default email content type is text/plain which does not allow using HTML. Add this to your functions.php file: // use HTML instead of plain text add_filter( ‘wp_mail_content_type’, ‘my_awesome_mail_content_type’ ); function my_awesome_mail_content_type() { return ‘text/html’; } But be warned, different email clients has very different support for CSS rules.. Read more from here. Alternative: If … Read more

Prevent sending emails on user creation in OOP context?

send_password_change_email and send_email_change_email are the filters used for sending the user an email, if they change their password or an account has been created for them. It is not responsible for the “New user registration on your site” mail. The function that does this is wp_new_user_notification(), which is actually one of the pluggable functions. You … Read more

Generate Email if No Posts Within Time Period

You’ll need to set up a cron job that checks once a day to see if the latest post is more than seven days old. So, some where in a plugin file. Schedule a new event. Then hook into that event. Grab the post date, turn it into a unix time stamp, and compare that … Read more

Do action for only switch status for publish_post

You can use the transition_post_status hook, which is fired whenever the status is changed. So to perform an action when the status is changed to publish, you’d do this: function notificationApprove( $new_status, $old_status, $post ) { if ( ‘publish’ === $new_status && ‘publish’ !== $old_status && ‘post’ === $post->post_type ) { // Send mail } … Read more

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