WP_Post is a representation of the post as it exists in the database, and the permalink isn’t stored in the database.
It’s not stored in the database because it’s not a property of the post. The permalink is determined by the site’s address, its permalink structure, and the post’s slug. Imagine if updating the permalink structure on your site required that every post in the database had to be updated.
But then, I can’t do something like this to get the title:
get_title($prevPost);
You can
get_the_title($prevPost);
For consistency’s sake, you can also do:
get_the_permalink($prevPost);
Related Posts:
- Where is the old post permalink slug stored?
- Use category base slug in posts’ permalink
- How to automatically generate a unique random slug
- Custom permalink structure only for default posts
- Change permalinks for post type ‘post’ only
- Change the Slug of Post Type post to baseurl/post/%postname%
- Different permalink for posts and authors
- Keep getting same permalink with WP_Query?
- How to control which category will be picked for the slug of a post?
- Change slug with custom field
- Must permalinks always point to single post pages?
- Some posts returning 404 instead of displaying post
- Link for the page archive for posts, like using custom post types with get_post_type_archive_link
- Post in Multiple Categories to stay in current category (permalink, next previous post link)
- Random post permalink
- get_permalink executes link without https
- Permalink Settings: optional settings doesn’t apply to editor
- Create pretty permalink for a post knowing the permalink structure
- How to change the page break URL from ../post/2 to …/post/page2/
- Link post permalinks to subdirectory /post
- Remove permalink from images when inserting into post
- Remove the Edit button in posts for permalinks on certain user roles? WP 3.3
- Dynamically generate child-URLs for posts or custom posts
- Bulk update post slugs through database
- Adding parent pages to posts
- Plain permalinks not working!
- Removing rel=”nofollow” from links posted in Post Content
- How to change permalink on post click on post listing page
- Changing Permalinks for Default Post type to reflect navigation
- Using permalinks, category slugs, and tag slugs
- Move first half of posts to one parent page, second half to the other page
- How to check a post exist when the permalink has post id in it?
- After database migration, posts not showing up in dashboard
- How to do set post permalinks using 6 digit random unique function?
- Trying to use AngularJS with WordPress without any API
- How could I change my Permalink from blog to custom structure? [closed]
- Any way for get_next_post() to use the actual post order instead of publish order?
- how do i add posts-page slug before posts slug in permalinks
- Permalink doesn’t get displayed in Twitter button (Local WordPress problem?)
- the_permalink() not working in a root installation
- Second get_permalink inside loop points to wrong URL
- Custom Permalink Structure for Pages & Posts
- register_post_type permalink
- Post is blank when I click on the link
- Unabled to Change Permalinks – Even Using the “Edit” (Resets to Original Permalink on “Update”)
- Post/page title to permalink transformation – what is behind the scenes?
- Post titles and thumbnails as links to custom post types?
- Internal linking to posts permalink fail because of spaces and stripe at postname
- Link post images to post
- Making posts permalinks consistent numbers
- Can Permalink structure of %postname%/%post_id% improve performance
- How to link post titles on page A to its posts on page B?
- Problems with WordPress in subfolder, posts show a blank page
- how to create a sub section in posts
- Categories Listing and Highlighting current category item
- Rewriting blog permalinks
- How can I add random alphabets in wordpress permalink posts structure
- Remove subcategory slug from url
- Can I show category name in url for only one of my categories?
- Permalink Short code showing unnecessary link text inside the loop
- Please help a newbie with blog page issue?
- Private post caught in endless redirect loop
- How to add a ‘News’ section to specific posts in WordPress
- Add a url parameter to the current post and read it in a shortcode
- How can I set the permalink of an article / page equal to the permalink of an existing article / page?
- Prevent Archive URLs
- Custom Post Types and Broken Permalinks
- Custom permalink for wordpress page / post
- How to add category base prefix to wordpress permalink
- Category URL to use same string as Post URL Permalink
- Permalink base only for posts
- Change the URL of posts by category
- How to give priority to page than to posts permalink structure?
- Append a random string to a post permalink
- Point users to a specific url directory for some posts
- Post & Category Archives URL structure
- Posts in Page – How to customize the URL?
- Is there a way to change the complete URL of the blog post for a redirecting tracking link?
- WordPress with static posts page and custom permalink structure doesn’t find posts with numeric permalinks
- Can’t seem to replicate permalink structure for localhost development site
- WordPress rewrite url help needed
- Permalink of some posts change
- My posts section for logged in user
- One of my posts is displayed as page
- Make assigning post to a specific category equivalent to assigning it to all categories
- How to mix pages and sub-categories in a url
- Modifying the permalink href for posts with jquery
- Changing permalink of custom category
- Overwrite URL on blog posts
- 301 Redirecting posts without %postid% (just %post_name%) in permalink to ones with %post_name%_%postid%
- How do I add /blog/ on my permalink without affecting the portfolio project types permalink?
- Permalink remain the same on each page
- Read more link not working [closed]
- After the local installation of an old WP website I can see the homepage but I can’t access to the articles, why?
- Changes done in admin panel are taking time to reflect in the REST api responses
- How can I fixe the article title problem?
- Why can posts never have a number as the link?
- Modify Post URL Programmatically
- Custom permalink for ‘post’ not working
- Permalink issue with new blog posts > getting 301 redirect