Skip to content

Instantly share code, notes, and snippets.

@tinotriste
Last active January 28, 2021 20:29
Show Gist options
  • Save tinotriste/5388318 to your computer and use it in GitHub Desktop.
Save tinotriste/5388318 to your computer and use it in GitHub Desktop.
Wordpress: Display a page parent's slug
<?php
// Display a page parent's slug
$post_data = get_post($post->post_parent);
$parent_slug = $post_data->post_name;
echo $parent_slug;
?>
@old-cory
Copy link

old-cory commented Apr 1, 2020

Thanks @Xhynk

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment