diff --git a/2meet-data-optimizer-hivepress-addon.php b/2meet-data-optimizer-hivepress-addon.php index fca2af6..dc9502b 100644 --- a/2meet-data-optimizer-hivepress-addon.php +++ b/2meet-data-optimizer-hivepress-addon.php @@ -3,7 +3,7 @@ * Plugin Name: 2meet Data Optimizer — Hivepress AddOn * Plugin URI: https://2meet.io/2meet-data-optimizer/hivepress * Description: HivePress + 12 擴充整合:13 adapter (core/reviews/bookings/messages/memberships/requests/favorites/statistics/tags/seo/social-links/blocks/marketplace) + 7 HPCT interceptor + 5 query interceptor + admin tab + CLI namespace - * Version: 0.5.1 + * Version: 0.5.2 * Requires at least: 6.0 * Tested up to: 6.9.4 * Requires PHP: 8.1 @@ -24,7 +24,7 @@ if ( ! defined( 'ABSPATH' ) ) { exit; } -define( 'TMDO_HIVEPRESS_VERSION', '0.5.1' ); +define( 'TMDO_HIVEPRESS_VERSION', '0.5.2' ); define( 'TMDO_HIVEPRESS_PATH', plugin_dir_path( __FILE__ ) ); define( 'TMDO_HIVEPRESS_URL', plugin_dir_url( __FILE__ ) ); define( 'TMDO_HIVEPRESS_FILE', __FILE__ ); diff --git a/CHANGELOG.md b/CHANGELOG.md index 22cad94..51c034a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,16 @@ Versioning follows [Semantic Versioning](https://semver.org/). --- +## [0.5.2] — 2026-10-05 — attribute bridge 的 meta key + +### Fixed + +- **`TMDO_HivePress_Attribute_Bridge` 組出正確的 meta key**:HivePress 把每個模型的屬性存成 + `hp_{slug}`(例如 `hp_warranty`),不是 `hp_{model}_{slug}`。舊的 key 在資料庫裡不存在, + 照它建議的欄位登記後永遠是空的。 + +--- + ## [0.5.1] — 2026-10-02 — 重新打包 ### Changed diff --git a/includes/hivepress/class-tmdo-hivepress-attribute-bridge.php b/includes/hivepress/class-tmdo-hivepress-attribute-bridge.php index 7658905..f8b71cd 100644 --- a/includes/hivepress/class-tmdo-hivepress-attribute-bridge.php +++ b/includes/hivepress/class-tmdo-hivepress-attribute-bridge.php @@ -20,7 +20,7 @@ * Usage: * $bridge = new TMDO_HivePress_Attribute_Bridge(); * $candidates = $bridge->discover_attributes(); - * // returns: [['slug' => 'beds', 'type' => 'integer', 'filterable' => true, 'searchable' => true, 'meta_key' => 'hp_listing_beds'], ...] + * // returns: [['slug' => 'beds', 'type' => 'integer', 'filterable' => true, 'searchable' => true, 'meta_key' => 'hp_beds'], ...] * * @package WP_Data_Optimizer * @since 3.0.0 @@ -123,7 +123,8 @@ if ( ! class_exists( 'TMDO_HivePress_Attribute_Bridge' ) ) { return array( 'model' => $model, 'slug' => $slug, - 'meta_key' => sprintf( 'hp_%s_%s', $model, $slug ), + // HivePress stores every model's attribute as hp_{slug} (e.g. hp_warranty), not hp_{model}_{slug}. + 'meta_key' => 'hp_' . $slug, 'type' => (string) ( $cfg['edit_field']['type'] ?? $cfg['search_field']['type'] ?? 'text' ), 'filterable' => (bool) ( $cfg['filterable'] ?? false ), 'sortable' => (bool) ( $cfg['sortable'] ?? false ), diff --git a/tests/unit/AttributeBridgeTest.php b/tests/unit/AttributeBridgeTest.php index da98834..7e45036 100644 --- a/tests/unit/AttributeBridgeTest.php +++ b/tests/unit/AttributeBridgeTest.php @@ -62,7 +62,7 @@ class HivePressAttributeBridgeTest extends TestCase { $this->assertSame( 'listing', $record['model'] ); $this->assertSame( 'beds', $record['slug'] ); - $this->assertSame( 'hp_listing_beds', $record['meta_key'] ); + $this->assertSame( 'hp_beds', $record['meta_key'] ); $this->assertSame( 'integer', $record['type'] ); $this->assertTrue( $record['filterable'] ); $this->assertFalse( $record['sortable'] );