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 would like to add custom post type loop to the functions.php. I've created PHP function to validate contact form (contact form 7). My function is simple, but it doesn't solve my problem.

My custom post type is created to define TITLE of password, so 1 custom post = 1 password.

I would like to load my loop into my function but impossible for me.

This is my code:

function custom_email_validation_filter($result,$tag){
    $type = $tag['type'];
    $name = $tag['name'];
    if($name == 'your-id'){ // Only apply to fields with the form field name of "company-email"
        $the_value = $_POST[$name];
        if(( $the_value != 'test' ) && ( $the_value != 'test2' )) {
            $result['valid'] = false;
            $result['reason'][$name] = "Votre identifiant n'est pas correct";
    return $result;
add_filter('wpcf7_validate_text','custom_email_validation_filter', 10, 2); 
add_filter('wpcf7_validate_text*', 'custom_email_validation_filter', 10, 2); 

So "test" and "test2" are PASSWORD, but I would like to connect my custom post type to change this password.

share|improve this question
add comment

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer


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

Browse other questions tagged or ask your own question.