Capturing arbitrary semantic URL arguments

So,

My articles have this URL structure :

mydomain.com/category/article-name

I’m using ACF to add additional information to my post types. For example, another text field with some related information to my article. Let’s call that field tab-1.

I don’t wan’t to show all this extra data immediately on the article page, but I want to have some sort of subpage on my article for that kind of extra data.

For example, this would be url of my sub page that will show only content from my article tab-1 field:

mydomain.com/category/article-name/tab-1

Is something like this achievable in wordpress? Essentially, I’d just like to capture that extra URL part /tab-1 in my template file and than base on it’s actual value, show appropriate field on the article.

And all that without getting 404 error 😀

1 Answer
1

The thing in WP that hits a passable balance of such functionality to not so painful implementation is rewrite endpoint.

They are structured a little differently from your example (i.e. /tab/2) but they are easy to implement and order of magnitude less painful than dealing with Rewrite API usually is.

Leave a Comment