10 events found.
function scan_form_plugins_usage() { if ( ! current_user_can( 'manage_options' ) ) return; if ( ! isset( $_GET['scan_forms'] ) ) return; $results = []; $posts = get_posts([ 'post_type' => 'any', 'post_status' => 'publish', 'posts_per_page' => -1, ]); foreach ( $posts as $post ) { $content = $post->post_content; $found = []; // Contact Form 7 shortcode: [contact-form-7 ...] if ( preg_match_all( '/\[contact-form-7[^\]]*\]/', $content, $matches ) ) { $found['CF7'] = $matches[0]; } // Gravity Forms shortcode: [gravityforms id="..."] or [gravityform id="..."] if ( preg_match_all( '/\[gravityform[s]?[^\]]*\]/', $content, $matches ) ) { $found['GravityForms'] = $matches[0]; } if ( ! empty( $found ) ) { $results[] = [ 'title' => $post->post_title, 'url' => get_permalink( $post->ID ), 'forms' => $found, ]; } } echo '
';
echo 'Form Plugin Usage Scan' . "\n\n";
if ( empty( $results ) ) {
echo 'No shortcode-based form embeds found.';
} else {
foreach ( $results as $r ) {
echo '--- ' . $r['title'] . ' ---' . "\n";
echo 'URL: ' . $r['url'] . "\n";
foreach ( $r['forms'] as $plugin => $shortcodes ) {
echo $plugin . ': ' . implode( ', ', $shortcodes ) . "\n";
}
echo "\n";
}
}
echo '';
die();
}
add_action( 'init', 'scan_form_plugins_usage' );