Posted By

tomasdev on 02/26/11



Versions (?)

WordPress get parent slug

 / Published in: PHP

This is a really short function you can use inside The Loop to get the parent page slug (useful to add to the body classes or something)

  1. function get_parent_slug(){
  2. $parent = get_page($post->post_parent);
  3. return $parent->post_name;
  4. }

Report this snippet  

You need to login to post a comment.