true, 'single' => true, 'type' => 'string', 'default' => self::get_default_value(), 'auth_callback' => '__return_true', ); foreach ( array( 'post', 'page' ) as $post_type ) { register_post_meta( $post_type, self::META_NAME, $args ); } } public static function is_valid_meta_value( $meta_value ) { return in_array( $meta_value, array( 'show', 'hide' ), true ); } public function register_block_editor_setting( $editor_settings ) { $editor_settings['styles'][] = array( 'css' => 'body{' . PostMetaServices::map_array_to_css( self::get_css_array() ) . '}', 'author' => 'brandy', 'type' => 'post_title', ); return $editor_settings; } public static function get_css_array() { $current_post_id = brandy_get_current_page_id(); if ( empty( $current_post_id ) ) { return array(); } $meta_value = self::get_value( $current_post_id ); return array( '--page-title-display' => 'hide' == $meta_value ? 'none' : 'block', ); } }