Last active
February 14, 2018 04:26
-
-
Save gatespace/cfa050de7aafc4cebb7ae33d69398b1f to your computer and use it in GitHub Desktop.
WordPress 特定の投稿だけAMPにしたい ref: https://qiita.com/gatespace/items/2b305b12845b952c6943
This file contains hidden or 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 | |
add_filter( 'amp_skip_post', 'my_amp_skip_post' 10, 3 ); | |
function my_amp_skip_post( $flag, $post_id, $post ) { | |
$flag = true; | |
$checked = get_post_meta( $post_id, '_my_amp_post_control', true ); // カスタムフィールドの値取得 | |
if ( $checked == 1 ) { | |
$flag = false; | |
} | |
return $flag; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment