WordPress.org

Ready to get started?Download WordPress

Forums

Contact Form 7
404 when there is no ? in the url (2 posts)

  1. xaratas
    Member
    Posted 3 years ago #

    After sending a form it gets a 404 error if no "?" is in the url. This happens if you set an other style of permalinks.

    I fixed it with this, in contact-form-7/includes/classes.php
    $url .= '?#' . $this->unit_tag;

    function form_html() {
    		$form = '<div class="wpcf7" id="' . $this->unit_tag . '">';
    
    		$url = wpcf7_get_request_uri();
    
    		if ( $frag = strstr( $url, '#' ) )
    			$url = substr( $url, 0, -strlen( $frag ) );
    
    		$url .= '?#' . $this->unit_tag;
    
    		$url = apply_filters( 'wpcf7_form_action_url', $url );
    		$url = esc_url_raw( $url );
    
    ...

    But it should better check if there is allready a "?" in the url.

  2. Takayuki Miyoshi
    Member
    Plugin Author

    Posted 3 years ago #

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic