Create pretty permalink for a post knowing the permalink structure

How can I generate a pretty permalink correctly for a post knowing the permalink structure?

My posts where processed with the FeedWordPress plugin with the “Link” setting set to “Permalinks point to: The copy on the original website”.

So for all the posts in the admin area when editing a post the “Permalink” field under the post title shows an original, external site’s URL, which is stored in the “syndication_permalink” meta data.

What I would like to do is to generate a pretty permalink for all such posts that would point to a local host (i.e. the post will have a permalink of type “http://mysite.com/” rather than have an external link to a source), so that I can update the permalinks in DB.

I can get the permalink structure using get_option('permalink_structure'). Is there a WP function that I can use to get a pretty permalink generated correctly for a post by its ID?

Hope that makes sense.

Thanks,
Dasha

2 Answers
2

GUID and permalink are two completely independent things. GUIDs are usually based on permalinks, but they don’t have to be. Permalinks are not based on GUIDs in any way in modern WP (it had been changed long ago).

If you permalinks are not being generated correctly then that plugin (or some other) is breaking something in a bad way, it is unrelated to what your GUIDs contain.

Leave a Comment