Get full slug for a WordPress Post

Question

I am using this code to get the URL of a post which is subsequently used as input on a form field.

 global $post;$post_slug = $post->post_name;$post_slug = urlencode($post_slug);

However, this code doesn’t return the category of the post.

0
JoaMika 1 month 2022-10-28T03:47:53-05:00 0 Answers 0 views 0

Leave an answer

Browse
Browse