  The Bogomolov multiplier $B_0(G)$ of a finite group $G$ is defined as the
subgroup of the Schur multiplier consisting of the cohomology classes vanishing
after restriction to all abelian subgroups of $G$. The triviality of the
Bogomolov multiplier is an obstruction to Noether's problem. We show that if
$G$ is a central product of $G_1$ and $G_2$, regarding $K_i\leq Z(G_i), i=1,2$,
and $\theta:G_1\to G_2$ is a group homomorphism such that its restriction
$\theta\vert_{K_1}:K_1\to K_2$ is an isomorphism, then the triviality of
$B_0(G_1/K_1), B_0(G_1)$ and $B_0(G_2)$ implies the triviality of $B_0(G)$. We
give a positive answer to Noether's problem for all $2$-generator $p$-groups of
nilpotency class $2$, and for one series of $4$-generator $p$-groups of
nilpotency class $2$ (with the usual requirement for the roots of unity).
