WordPress function to retrieve the slug of a page

Add the method to functions.php

// retrieve post page slug
function the_slug() {
global $post;
$post_data = get_post($post->ID, ARRAY_A);
$slug = $post_data['post_name'];
return $slug;
}
This entry was posted in Scripts, WebDev, articoli, obertfsp, portfolio, wordpress. Bookmark the permalink.

Lascia un Commento

Indirizzo eail che non verrĂ  pubblicatao. I campi obbligatori sono contrassegnati *

*

È possibile utilizzare questi tag ed attributi XHTML: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>