Title: [Plugin: WP Permastructure] Custom Structure Tag
Last modified: August 20, 2016

---

# [Plugin: WP Permastructure] Custom Structure Tag

 *  [Enzo](https://wordpress.org/support/users/doctorwombat/)
 * (@doctorwombat)
 * [13 years, 7 months ago](https://wordpress.org/support/topic/plugin-wp-permastructure-custom-structure-tag/)
 * Thank you for the great plugin. I’ve run into an issue that I was hoping to get
   some insight into.
 * I’m trying to create a custom structure tag **%postparent%** for the permalink
   settings. Here is the code I have in my functions.php:
 *     ```
       add_filter('post_link', 'post_parent_permalink', 10, 3);
       add_filter('post_type_link', 'post_parent_permalink', 10, 3);
   
       function post_parent_permalink($permalink, $post_id, $leavename){
               // the code here will eventually determine the post's parent slug
               $slug = 'hello-world';
       	return str_replace('%postparent%', $slug, $permalink);
       }
       ```
   
 * If I put %postparent% into the regular WordPress’s custom structure (Under Settings-
   >Permalinks->Common Settings), it works, and I see “hello-world” in my URL.
 * However, if I try to put %postparent% into one of my custom post-type structure
   fields (the ones generated by WP Permastructure), all I get in the URL is %postparent%.
 * **So to reiterate:**
 * Common Settings -> custom structure:
    `/%postparent%/%postname%`
 * outputs to [http://myblog.com/hello-world/the-post-title](http://myblog.com/hello-world/the-post-title)
 * Custom post type permalink settings -> custom post type structure:
    `/%postparent%/%
   postname%`
 * outputs to [http://myblog.com/%postparent%/the-custom-posttype-post-title](http://myblog.com/%postparent%/the-custom-posttype-post-title)
 * I’m just wondering if this an issue with the plugin not recognizing the filters
   I’ve placed. Any help would be greatly appreciated. Thanks.
 * [http://wordpress.org/extend/plugins/wp-permastructure/](http://wordpress.org/extend/plugins/wp-permastructure/)

The topic ‘[Plugin: WP Permastructure] Custom Structure Tag’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/wp-permastructure.svg)
 * [WP Permastructure](https://wordpress.org/plugins/wp-permastructure/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wp-permastructure/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wp-permastructure/)
 * [Active Topics](https://wordpress.org/support/plugin/wp-permastructure/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wp-permastructure/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wp-permastructure/reviews/)

## Tags

 * [permalink](https://wordpress.org/support/topic-tag/permalink/)
 * [Permalink structure](https://wordpress.org/support/topic-tag/permalink-structure/)
 * [structure tag](https://wordpress.org/support/topic-tag/structure-tag/)

 * 0 replies
 * 1 participant
 * Last reply from: [Enzo](https://wordpress.org/support/users/doctorwombat/)
 * Last activity: [13 years, 7 months ago](https://wordpress.org/support/topic/plugin-wp-permastructure-custom-structure-tag/)
 * Status: not resolved