wordpress - Fetch contact-form-7 id to another plugin -
how fetch contact-form-7 forms id, plugin??
i want forms id , using id, ill give effect form, please tell me how fetch form id contact-form-7, plugin in wordpress.
actually in contact form 7,the post type wpcf7_contact_form can use bellow code . in tis code function return array of contact form's id.
function get_cf7_ids(){ $cf7_id_array =array(); if ( post_type_exists( 'wpcf7_contact_form' ) ) { $args = array( 'post_type' => 'wpcf7_contact_form', 'posts_per_page'=>-1, ); $the_query = new wp_query( $args ); if ( $the_query->have_posts() ) { while ( $the_query->have_posts() ) { $the_query->the_post(); $cf7_id_array[]= get_the_id(); } wp_reset_postdata(); } } return $cf7_id_array; //return array of ids }
then use function ides in array get_cf7_ids(). let me know result. thanks
Comments
Post a Comment