The slug is already in the post object, it’s $post->post_name
.
And as you observed, yes, the way to get the post link is get_permalink( $post->ID );
Related Posts:
- prevent showing posts of an specific category in admin posts section
- How to add an admin notice upon post save/update
- Adding additional data to WP_Post object
- WP_Query: Why is sticky post not first item in loop?
- How do I reorder (pop and push) items from WP_Query?
- How to exclude latest x posts from a paginated query?
- Reverse chronology of post listing
- WP_Query to work with custom view
- WooCommerce – Create Products Programatically [closed]
- Most viewed post for the last 2 days using WP_Query
- Adding Post Counts to Menu (Nav) Programmatically?
- This AJAX Code Doesn’t Work – Looking for elegant solution
- How to add posts to wp_query result?
- Posts for next month
- WP_Query only ONE post, won’t work
- Replace Main Query With Custom Query
- Hide Post comments when displayed via WP_Query
- Hiding posts in a list from specified categories
- Group posts by year in loop
- wp query with dynamic taxonomies and terms?
- How to get posts by multiple post slugs? [duplicate]
- Blogroll – Different layout for first post
- How do I use `posts_distinct` correctly?
- How can I remove posts of a certain category from homepage after a specified time period?
- Automatic value for custom fields for posts
- Loop through all product posts?
- Get random posts between specific dates / of specific age
- How to find what index page a post is on?
- Display post from current category and same tag?
- Get Posts that are in the current month or later
- WP Query to Get Array of Slugs
- How to get post bulk edit action trigger and get edited post ids?
- How can I sort posts by the date and a custom meta field?
- Hiding Draft Post In Admin
- How to verify wp user password by sql query in wp? [closed]
- updating a post doesn’t trigger a function
- Hide a specific category in admin All Posts page (WordPress)
- How to return another post than requested
- Updating post data on save (save_post vs wp_insert_post_data)
- Lost draft under all posts and drafts
- Get user categories with most posts in it
- Query Posts With Over 1000 Views
- List authors with the last post title and order by last post date
- How to order posts by meta_value and title
- WordPress query_posts by tag doesn’t work anymore(?)
- Ignore latest two posts
- Print out last 3 blogposts
- Why posts array is empty?
- How to group only VISIBLE posts? [closed]
- How to check in functions.php if there is data in a WP_Query?
- Shortcode with ‘year’ parameter
- On what hook can I get the queried object’s final state?
- Filter Hook for post table (not columns)
- why str_replace targeting pages instead just targeting post?
- How can I insert a new markup element after 4 posts automatically? [closed]
- how to handle the loop using filling bootstrap grid structure?
- Get all custom posts with a certain taxonomy
- Link to date_query results in WordPress
- When WP_Query only returns 1 post, how do I automatically redirect to that post?
- Limiting post list by taxonomy
- How to display WP Query filters?
- Is there a function to get post info for any publish_status by post ID?
- How Can I Always Display A Particular Post First Using WP_Query?
- Optimal WP Web App Backend for mobile app development
- How do I display main query posts in random order using add_filter
- Why sorting posts doesn’t work properly?
- the wp_post_update isn’t working all the time
- WordPress: Develop multiple posts with different data
- query posts with selected post ids first
- Change URL of previous posts and next posts link in WordPress
- How to invoke a HTML custom button based on a HTML dropdownlist menu
- Order posts inside bootstrap card columns
- long-title posts do not want published
- How to get value of a selected option from select tag and use it in WP_query to filter posts?
- Counting Posts by Category
- show image gallery in archives or category page
- Page with Category Returning 1
- The first post appears twice
- wp_query args with relation
- WP_Query sort by meta_value_num or date
- Get 5 most recent categories
- Creating Ordered Query using Meta_key
- Fixing the WP Post Object for Custom Route
- Custom plugin to get related posts by category
- WP Query between posts custom fields [duplicate]
- Retrieve latest post by multiple categories with ID
- Update Post with Modified Data
- Can’t get pagination to work
- How to Include a common category in a custom Category Search
- wp_query select if have comments
- wp_query posts sorting doesn’t work
- Order by ‘s’ using WP_Query()
- custom sort posts in archive/taxanomy page
- how to print loops for odd in 1st column and even in 2nd column in wordpress [closed]
- Trying to create shortcode listing custom posts, but formating not being included
- Show Title/Date/Excerpt of first post & only Title for rest in Query [duplicate]
- Get posts after calculating meta key
- Onclick open posts displayed in slider in a popup [closed]
- How edit footer copyright info? [closed]
- date_query returning only the most recent post instead of the post published before today