Skip to content

Instantly share code, notes, and snippets.

@campusboy87
Last active September 22, 2018 21:04
Show Gist options
  • Select an option

  • Save campusboy87/45c71248bc4047801d975cf2bec4b809 to your computer and use it in GitHub Desktop.

Select an option

Save campusboy87/45c71248bc4047801d975cf2bec4b809 to your computer and use it in GitHub Desktop.
Преобразует WordPress шорткоды до того, как будут преобразованы теги (шорткоды) Contact Form 7.
<?php
add_filter( 'wpcf7_form_elements', function () {
$manager = WPCF7_FormTagsManager::get_instance();
$form_html = do_shortcode( WPCF7_ContactForm::get_current()->prop( 'form' ) );
if ( wpcf7_autop_or_not() ) {
$form_html = $manager->normalize( $form_html );
$form_html = wpcf7_autop( $form_html );
}
$form_html = $manager->replace_all( $form_html );
//$form_obj->scanned_form_tags = $manager->get_scanned_tags();
return $form_html;
} );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment