Skip to content

Commit 948aca3

Browse files
Copilotswissspidy
andcommitted
Convert post to WP_Post object before getting terms
Use get_post() to ensure we have a proper WP_Post object before retrieving terms. This ensures wp_get_object_terms() can correctly access term relationships that may not be available on raw database objects. Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
1 parent c460364 commit 948aca3

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

src/WP_Export_Query.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,8 @@ public function nav_menu_terms() {
137137
}
138138

139139
public function exportify_post( $post ) {
140+
// Ensure we have a proper WP_Post object for term retrieval.
141+
$post = get_post( $post );
140142
$GLOBALS['wp_query']->in_the_loop = true;
141143
$previous_global_post = Utils\get_flag_value( $GLOBALS, 'post' );
142144
// phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited -- Temporary override.

0 commit comments

Comments
 (0)