get_post_meta not working with variable as a post_id for dynamically get the postid
You can try to add global $post; on top of your code. But it depends on where the function is called.
You can try to add global $post; on top of your code. But it depends on where the function is called.
…Removed my prior ‘solutions’… So, the real problem here is that this function is hooked to publish_post action, at which point the post might not be saved yet, if it is a new post. Only if it is a post already saved but with some other status, we can access the ACF values using get_field(). … Read more
I would just use str_replace() to handle a “pseudo” shortcode. Something like this: $body = sprintf(‘Hey {{username}}, your awesome post has been published! See <%s>’, get_permalink($post) ); // Add replacement values to the array as necessary. $old = array( ‘{{username}}’ ); $new = array( esc_html($user->display_name) ); $body = str_replace( $old, $new, $body ); // Now … Read more
Post by email does not work by accessing wp-mail.php. You need to go to Settings > Writing on your website and enter POP3 credentials for whatever email address you plan to use. After that, any email you send TO that email address will be parsed and posted.
As you mentioned, it could be a plugin. Tracking that down would require deactivating other plugins and retesting to find out. Tracking down the actual problem is really what you need to do. However, in absence of actually finding the problem, you may be able to filter out the new line indicator with the following … Read more
I found the “issue”. I had another mailing provider (Postmark) installed as a plugin, which I brought in my local site by mistake. That prevailed over any other mailing configuration. I deactivated the plugin and now my hook works fine.
This is untested, but it’s kind of the approach you need to take. I’m just dealing with the last method in your class. Here’s how I would approach it: You need to specify a file path when you save the file so you can use that later to get the file to attach. Set up … Read more
There are a wide variety of things this could be, so any answers to this question would be speculation. Keep in mind, it’s the email that gets marked as spam (and the details of the sender, domain, etc), not the code that generates the email. That being said, I would investigate the sender information first … Read more
In your email code you’re using mail PHP function, whereas WordPress uses its own internal wp_mail function that then sends the email using PhpMailer (for many different reasons) .. which should be using PHP’s mail fn but there’s a number of different things that could be causing problems. You can also install the “WP Mail … Read more
You can test if mail has been sent or not using the following: // Set $to as the email you want to send the test to. $to = “[email protected]”; // Email subject and body text. $subject=”wp_mail function test”; $message=”This is a test of the wp_mail function: wp_mail is working.woo!”; $headers=””; // Load WP components, no … Read more