diff --git a/inc/Core/Steps/Publish/Handlers/WordPress/WordPress.php b/inc/Core/Steps/Publish/Handlers/WordPress/WordPress.php index dcbf384e9..4cdd42ab9 100644 --- a/inc/Core/Steps/Publish/Handlers/WordPress/WordPress.php +++ b/inc/Core/Steps/Publish/Handlers/WordPress/WordPress.php @@ -104,8 +104,11 @@ protected function executePublish( array $parameters, array $handler_config ): a $field_key = "taxonomy_{$taxonomy}_selection"; $selection = $handler_config[ $field_key ] ?? SelectionMode::SKIP; - if ( SelectionMode::isAiDecides( $selection ) && ! empty( $parameters[ $taxonomy ] ) ) { - $taxonomies[ $taxonomy ] = $parameters[ $taxonomy ]; + // Get the parameter name (e.g., 'post_tag' -> 'tags') + $param_name = TaxonomyHandler::getParameterName( $taxonomy ); + + if ( SelectionMode::isAiDecides( $selection ) && ! empty( $parameters[ $param_name ] ) ) { + $taxonomies[ $taxonomy ] = $parameters[ $param_name ]; } elseif ( SelectionMode::isPreSelected( $selection ) ) { $taxonomies[ $taxonomy ] = $selection; } diff --git a/inc/Core/WordPress/TaxonomyHandler.php b/inc/Core/WordPress/TaxonomyHandler.php index 495a2351c..1a204f7bc 100644 --- a/inc/Core/WordPress/TaxonomyHandler.php +++ b/inc/Core/WordPress/TaxonomyHandler.php @@ -241,7 +241,7 @@ private function processAiDecidedTaxonomy( int $post_id, object $taxonomy, array * @param string $taxonomy_name WordPress taxonomy name * @return string Corresponding parameter name for AI tools */ - private function getParameterName( string $taxonomy_name ): string { + public static function getParameterName( string $taxonomy_name ): string { if ( 'category' === $taxonomy_name ) { return 'category'; } elseif ( 'post_tag' === $taxonomy_name ) {