Skip to content

Instantly share code, notes, and snippets.

@madalinignisca
Created November 6, 2013 16:49
Show Gist options
  • Save madalinignisca/7339663 to your computer and use it in GitHub Desktop.
Save madalinignisca/7339663 to your computer and use it in GitHub Desktop.
a function to get a list of Contact Form 7
<?php
function get_contact_forms() {
$allContactForms7 = array();
global $wpdb;
global $table_prefix;
$table_prefix = $wpdb->base_prefix;
$wpdb->tablename = $table_prefix . 'posts';
$contact_forms7 = $wpdb->get_results(
"
SELECT ID,post_title
FROM $wpdb->tablename
WHERE post_type = 'wpcf7_contact_form'
"
);
foreach ( $contact_forms7 as $contact_form7 )
{
$allContactForms7[$contact_form7->ID] = $contact_form7->post_title;
}
return $allContactForms7;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment