fix(01-01): correct CPT registration hook timing
- CPT init hook was being added from within parent init hook - Changed to call register_post_type() directly from main init - Removed redundant hook from CPT constructor - Fixes CPT not registering on plugin activation
This commit is contained in:
@@ -32,7 +32,7 @@ class Umzugsliste_CPT {
|
||||
* Constructor
|
||||
*/
|
||||
private function __construct() {
|
||||
add_action( 'init', array( $this, 'register_post_type' ) );
|
||||
// CPT registration is called directly from main plugin init
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -65,8 +65,9 @@ class Umzugsliste {
|
||||
* Initialize plugin components
|
||||
*/
|
||||
public function init() {
|
||||
// Initialize CPT
|
||||
Umzugsliste_CPT::get_instance();
|
||||
// Initialize and register CPT
|
||||
$cpt = Umzugsliste_CPT::get_instance();
|
||||
$cpt->register_post_type();
|
||||
|
||||
// Initialize admin menu
|
||||
if ( is_admin() ) {
|
||||
|
||||
Reference in New Issue
Block a user