get_metabox_classes() as $class ) { $instance = new $class(); if ( method_exists( $instance, 'save' ) ) { $instance->save( $post_id, $params_handler ); } } // Save fields from the dynamically selected ad type. $ad_type_id = $params_handler->getKey( 'ad_type' ); if ( ! empty( $ad_type_id ) ) { $ad_type_object = AdTypeRegistry::get()->get_by_id( $ad_type_id ); if ( $ad_type_object && method_exists( $ad_type_object, 'save' ) ) { $ad_type_object->save( $post_id, $params_handler ); } } } /** * Returns an array of metabox classes to be registered for the Ad post type. * * @return array */ public function get_metabox_classes(): array { $default_boxes = [ Ad_Type_Box::class, Ad_Content_Box::class, Ad_URL_Box::class, Ad_Assignment_Box::class, Layout_Box::class, Scheduling_Frequency_Box::class, Conditions_Box::class, ]; /** * Filter to add or modify the metabox classes for the Ad post type. * * @param array $default_boxes The default metabox classes. */ return apply_filters( 'adpresso_ad_metabox_classes', $default_boxes ); } }