Created
October 5, 2022 03:07
-
-
Save takunagai/869abaea38afcf2de0be59b4ea0fc8ce to your computer and use it in GitHub Desktop.
[Spectra - Disable the Block display conditions for Page post type] 指定投稿タイプなら Block Conditon を無効に #WordPress #spectra
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 | |
/** | |
* Spectra - Disable the Block display conditions for Page post type. | |
* @ref https://wpspectra.com/docs/display-conditions-blocks/ | |
*/ | |
add_filter( 'enable_block_condition', function( $default = true) { | |
if (isset($_REQUEST['post_type']) && 'page' === $_REQUEST['post_type']) { | |
return false; | |
} elseif (isset($_GET['post']) && 'page' === get_post_type($_GET['post'])) { | |
return false; | |
} | |
return $default; | |
} ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment