Obtenez le poste attaché à une image en pièce jointe
-
16-10-2019 - |
Question
En supposant que je sais que l'ID de fixation d'image, comment puis-je obtenir le permalien poste auquel est attaché (le cas échéant)?
La solution
En gros ceci:
$parent = get_post_field( 'post_parent', $id);
$link = get_permalink($parent);
Licencié sous: CC-BY-SA avec attribution
Non affilié à wordpress.stackexchange