Getting page slug when custom permalink is set
-
I just ran into a small issue on my site that I thought would be worth mentioning to you.
Occasionally, I need access to the slug of the page that I’m working on ($post->post_name). I have a small helper function that takes care of this for me. However, I realized that when using the Custom Permalinks plugin, the slug of the page is not directly updated in the database when I change it in the admin section.
From what I can tell, any time I change the url of a given post/page after it has been published (while your plugin is activated), the plugin overrides the normal execution of the WordPress core, and instead forces the new url to be saved into a meta field. Thus, it was necessary for me to put a custom piece of code into my get_the_slug helper function that was specific to the Custom Permalinks plugin.
I thought the plugin might be a little more transparent (and thus better for the end user), if the slug (post_name) of the post were to be updated in the database as well as having the custom permalink saved into the meta field.
I haven’t run through the code of your plugin in much detail, and so I don’t know if such an implementation would be feasible to the way it works, but I thought I’d mention it just in case. Because I do think it’d make the plugin just a little bit better. ??
Great plugin by the way. Works awesomely.
- The topic ‘Getting page slug when custom permalink is set’ is closed to new replies.