[wp-hackers] Rewrite API CPT Parent Slug Removal
Andrew Nacin
wp at andrewnacin.com
Thu Apr 25 21:50:37 UTC 2013
Taxonomies have the ability to opt-in to a hierarchical URL with
$args['rewrite']['hierarchical'] = true. Post types do not. However, you
should be able to just use the filter post_type_link in
get_post_permalink() to change the generated URL. You might need to do an
additional filter in query.php, but I'm pretty sure things will just work.
On Thu, Apr 25, 2013 at 4:41 PM, Jesse Friedman <me at jes.se.com> wrote:
> I'm trying to remove the parent page slug from a CPT url.
>
> For Example:
>
> http://jes.se.com/portfolios/web/my-website
>
> - where My Website is a child of Web
> - portfolios = CPT slug
> - web = Parent page slug
> - my-website = page slug
>
>
> I am attempting to remove "web" with the Rewrite API but I'm having
> difficulty. I want the url to be:
>
> http://jes.se.com/portfolios/my-website
>
>
> Any push in the right direction would be greatly appreciated.
>
> --
> thanks
>
> *jesse friedman*
> jes.se.com *
> *
> Book: Web Designers Guide to WordPress -
> http://wdgwp.com/onamazon<http://wdgwp.com/onamazon>
> Twitter: @professor <http://twitter.com/professor>
> Facebook: Like<
> https://www.facebook.com/pages/Jesse-Friedman/204793299545174>
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>
More information about the wp-hackers
mailing list