*/ public function get_keywords_for( int $post_id, string $post_type = 'post' ): array { if ( $post_id <= 0 || 'post' !== $post_type || ! function_exists( 'get_post_meta' ) ) { return array(); } $raw = get_post_meta( $post_id, '_sq_post_keyword', true ); if ( empty( $raw ) ) { return array(); } if ( is_string( $raw ) ) { $data = maybe_unserialize( $raw ); } else { $data = $raw; } if ( ! is_array( $data ) ) { return array(); } $kw = trim( (string) ( $data['keyword'] ?? '' ) ); return '' !== $kw ? array( $kw ) : array(); } }