WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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
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

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

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;
share|improve this answer

Your Answer


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.