Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I want to block front end submitted posts if they contain certain words or website addresses and such. I can set the post type all to draft when submitted but want to keep set up to publish but be able to moderate them somewhat.

I am currently submitting the post with a gravity form. I want my cpt to be like a comment really and hoped I could hook into the comments system to moderate posts based on settings in the discussion settings.

I am looking for direction or suggestions on how to best do this. A pro coder I am not but I can figure things out with a start or good tutorial.

Everything on moderation I find is for comments.

share|improve this question
    
What have you tried so far? –  s_ha_dum Dec 26 '12 at 20:06
    
Could you please add more details to your question? The code you are using to save the post would be a good start. –  toscho Dec 26 '12 at 20:26
    
The post is submitted with a gravity form. I have no code but will set something up based on livearoha suggestion below. –  Michael B Dec 26 '12 at 21:25
add comment

1 Answer

Within the loop you can output the post only if it does not match your banned words

<?php
while ( have_posts() ) : the_post();
    $banned = array('badword', 'http://');
    $ok = true;
    foreach ( $banned as $value ) {
        if ( stristr( $post->post_content, $value ) ) {
            $ok = false;
        }
    }
    if ( $ok ) : ?>
        <h2><?php the_title(); ?></h2>
        <?php the_content(); ?>
    <?php endif;
endwhile;
?>
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.