Skip to content

Instantly share code, notes, and snippets.

@JeremyEnglert
Created August 20, 2025 18:29
Show Gist options
  • Save JeremyEnglert/1248a9e57f2a290e01f7722b20118005 to your computer and use it in GitHub Desktop.
Save JeremyEnglert/1248a9e57f2a290e01f7722b20118005 to your computer and use it in GitHub Desktop.
ClassifAI Key Takeaways Frontend Fix
<?php
/**
* Plugin Name: ClassifAI Key Takeaways Frontend Fix
* Description: Ensures the Key Takeaways block is always registered for frontend display
* Version: 1.0
* Author: Materiell
* Author URI: https://materiell.com
*/
// Register the key takeaways block on init for frontend display
add_action( 'init', function() {
// Only register if ClassifAI is active
if ( ! defined( 'CLASSIFAI_PLUGIN_DIR' ) ) {
return;
}
// Check if WP_Block_Type_Registry is available
if ( ! class_exists( 'WP_Block_Type_Registry' ) ) {
return;
}
// Check if block is already registered
$registry = WP_Block_Type_Registry::get_instance();
if ( $registry->is_registered( 'classifai/key-takeaways' ) ) {
return;
}
// Register the block for frontend rendering
register_block_type_from_metadata(
CLASSIFAI_PLUGIN_DIR . '/includes/Classifai/Blocks/key-takeaways'
);
}, 20 ); // Run after ClassifAI's init hooks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment