Skip to main content
7 events
when toggle format what by license comment
Nov 18, 2015 at 4:25 comment added Howdy_McGee Thanks @Milo - I've added some more context to the bottom of my question. This is an issue I've run into before where I've needed to process something in my query string to make some kind of pretty permalink but I haven't found a concrete solution online. Hopefully that makes the issue a little more clear - I'll report back if I make any more progress on it.
Nov 18, 2015 at 3:59 comment added Milo sorry, post_link isn't relevant in your case, I was just pointing out a situation where add_rewrite_tag would be useful, for adding tags that you can use in the default post permalink structure. if you can back up a few steps and explain in more detail in your question what you're trying to do, I can maybe offer more help!
Nov 17, 2015 at 22:57 comment added Howdy_McGee Honestly, I don't think the page_link filter is the correct filter I need to get the job done so I am probably using it in a poor context. post_link doesn't seem to work with the endpoint products though either since it's not killing the page with the die() at the top. So I have an imaginary page products in which I need to catch, process, and rewrite an additional query value. I'm looking into add_permastruct() now though to see if I can get somewhere with that, thanks for the suggestion.
Nov 17, 2015 at 22:42 comment added Milo I meant if you used a rewrite tag within the post permalink settings, you should see that tag within the post_link filter. You don't see a tag in the page_link filter because nothing is inserting that tag anywhere, that's not what add_rewrite_rule does. New permalink structures can be added via add_permastruct, where I believe you can use rewrite tags, which then in turn generates rewrite rules. I'm not really understanding the context in which you're using the page_link filter.
Nov 17, 2015 at 22:36 comment added Howdy_McGee Also, I tried adding the template tag into my permalinks /%custom_category%/postname/ but it didn't seem to make a difference in the output of the filter, wp_query or the permalink. Thanks for giving it some thought though!
Nov 17, 2015 at 22:33 comment added Howdy_McGee The post_link filter doesn't seem to "catch" my hook and kill the page like page_link does for some reason, I keep seeing post_link in the tutorials but it doesn't seem to work in this context. The issue with the $post object is that page_link doens't pass an object but an int post_id and even so, the actual page doesn't exist, I just need to process the given query val, return a nice string from an API I'm using then display a custom template accordingly. I'm not sure what you mean by I think you need to add a new permalink structure containing the tag... can you elaborate?
Nov 17, 2015 at 22:15 history answered Milo CC BY-SA 3.0