Support » Plugins » Hacks » Filtering post via email

  • Resolved Neil



    I am trying to filter posts made via email. If the email post contains a name, it will go to pending status. On wp-mail.php, after the following line:

    $post_content = apply_filters('phone_content', $content);

    I added this:

    if (preg_match("/Name Here/i", $post_content)) {
    	$post_status = 'pending';

    It seems not to work. Any ideas on how to add that filter?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Moderator bcworkz


    No idea why that doesn’t work. In any case, it’s very poor practice to edit core WP files. The next update will overwrite your edits. Some people are reluctant to update because of this, leaving them open to newly found security exploits.

    Doing things properly can be more convoluted unfortunately. In your case, you probably should let the post be published normally. You can hook the ‘publish_phone’ action (why phone? don’t know, that’s the right one though) and get the post info from the ID you’re passed. If you find the name in the content, then change the status and update the post.

    Your hook code can be placed in your own plugin, theme, or child theme.

    Sorry, I tried to update the question but there was an error. Anyway, the way I have it, it worked. Just took a little longer for the post sent via email to show up on the dashboard. I will keep in mind your suggestion about not editing core files. Thanks.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Filtering post via email’ is closed to new replies.