Skip to content

Instantly share code, notes, and snippets.

@takunagai
Created October 5, 2022 03:07
Show Gist options
  • Save takunagai/869abaea38afcf2de0be59b4ea0fc8ce to your computer and use it in GitHub Desktop.
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
<?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