blatantwaste
asked on
PHP Script to check permalink structure in WP
Those of you who have used Wordpress know that you can set your permalink structure with custom formats. What I want to know is if there is a way to run a php script within a plugin that will check how the user has their permalinks set up?
The reason I ask is because I have a plugin that generates a "Subscribe to comments" link for each post/page. This works 85% of the time because most people set up their permalinks like this:
/%category%/%postname%/
However, the other 15% of the time that it doesn't work is because someone either HASN'T set up their permalinks and is still using http://yoursite.com?p=40 - OR, they set up their permalinks like this:
/%category%/%postname%
The absence of the trailing slash at the end of the permalink completely ruins the subscribe to comments link that my plugin generates because it relies on that trailing slash being there so that the link will turn out like this:
http://yoursite.com/stuff/post-1/feed
Without it, the link turns out being output like this:
http://yoursite.com/stuff/post-1feed
So, I want to try to come up with a way that I can check how the user has their permalinks set up and then take the appropriate actions to always output the right link based on their permalink structure.
The reason I ask is because I have a plugin that generates a "Subscribe to comments" link for each post/page. This works 85% of the time because most people set up their permalinks like this:
/%category%/%postname%/
However, the other 15% of the time that it doesn't work is because someone either HASN'T set up their permalinks and is still using http://yoursite.com?p=40 - OR, they set up their permalinks like this:
/%category%/%postname%
The absence of the trailing slash at the end of the permalink completely ruins the subscribe to comments link that my plugin generates because it relies on that trailing slash being there so that the link will turn out like this:
http://yoursite.com/stuff/post-1/feed
Without it, the link turns out being output like this:
http://yoursite.com/stuff/post-1feed
So, I want to try to come up with a way that I can check how the user has their permalinks set up and then take the appropriate actions to always output the right link based on their permalink structure.
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
ASKER