*/ 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, 'rank_math_focus_keyword', true ); if ( ! is_string( $raw ) || '' === trim( $raw ) ) { return array(); } // Rank Math separates multiple keywords with commas. $parts = explode( ',', $raw ); $out = array(); foreach ( $parts as $part ) { $kw = trim( $part ); if ( '' !== $kw ) { $out[] = $kw; } } return $out; } }