Last active
January 24, 2021 20:01
-
-
Save westonruter/020dcab1545f24706cb34b1978c8708e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Jetpack AMP Contact Form Submission Fix plugin bootstrap. | |
* | |
* @package Google\Jetpack_AMP_Contact_Form_Submission_Fix | |
* @author Weston Ruter, Google | |
* @license GPL-2.0-or-later | |
* @copyright 2021 Google Inc. | |
* | |
* @wordpress-plugin | |
* Plugin Name: Jetpack AMP Contact Form Submission Fix | |
* Plugin URI: https://gist.github.com/westonruter/020dcab1545f24706cb34b1978c8708e | |
* Description: Work around issue with Contact Form where AMP form submissions are incorrectly identified as being non-frontend requests. | |
* Version: 0.1 | |
* Author: Weston Ruter, Google | |
* Author URI: https://weston.ruter.net/ | |
* License: GNU General Public License v2 (or later) | |
* License URI: http://www.gnu.org/licenses/gpl-2.0.html | |
* Gist Plugin URI: https://gist.github.com/westonruter/020dcab1545f24706cb34b1978c8708e | |
*/ | |
namespace Google\Jetpack_AMP_Contact_Form_Submission_Fix; | |
add_filter( | |
'jetpack_is_frontend', | |
static function ( $is_frontend ) { | |
if ( isset( $_POST['contact-form-id'] ) ) { | |
$is_frontend = true; | |
} | |
return $is_frontend; | |
} | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Installation instructions: https://gist.github.com/westonruter/6110fbc4bef0c4b8c021a112012f7e9c