Skip to content

Support for Elementor #140

@alkahan

Description

@alkahan

Sites built with elementor save their content with shortcode resolved as HTML code.
Indeed, post_content do not contains the contact form 7 short code but the HTML code of the form, and cf7a do not initialize.

I have modified the function cf7_shortcode_exists to make it working with elementor. I made the assumption that pages with forms have an hidden field named "_wpcf7_version". Maybe their is an other method or regex to be more specific :

private function cf7_shortcode_exists() {
		global $post;
		return is_a( $post, 'WP_Post' ) && (has_shortcode( $post->post_content, 'contact-form-7' ) || preg_match('/_wpcf7_version/', $post->post_content));
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions